f=file('test.txt') #读文件 data=f.readline() # data=f.readlines() # data=f.read() print data f.close()#关闭文件流 f2=file('t2.txt','w')#写入 f2.write('write in "file" ,1234\nwrite other line')#写入的内容 f2.close()
Python入门.读写文件
猜你喜欢
转载自8850702.iteye.com/blog/2279206
今日推荐
周排行