python读取文件 ###读取一行 filehand = open('C:\工作\字段整理.txt') line = filehand.readline() while line: print(line) print("=============") line = filehand.readline() ##读取全部 files = open('C:\工作\重要信息.txt') content =files.read() print(content) #一行一行遍历 files = open('C:\工作\重要信息.txt') lineall = files.readlines() for lines in lineall: print(lines) #写入文件到文件中 myfiles =open('C:\工作\重要信息.txt','a+') myfiles.write('\r\n') myfiles.write('thank you')
python的文件操作
猜你喜欢
转载自501565246-qq-com.iteye.com/blog/2331443
今日推荐
周排行