读文件:
读取文件 f = open(‘\info.txt‘) fil = f.read() f.close()
1 按行读文件 2 f = open("info.txt") 3 line = f.readline() 4 for each in line: 5 print each # 后面跟 ‘,‘ 将忽略换行符 6 f.close()
python (11)文件的读写
原文:http://www.cnblogs.com/lovychen/p/5329759.html