# -*- coding:utf-8 -*- Str = "Hello this is my Python\n" f = file("T:\\abc.txt","w") f.write(Str) f.close() f = file("T:\\abc.txt","r") print f.readline()#readline為讀取一行,read為讀取整份文件 Categories: Python