hello,这我的第一篇学习博客。。
对文件的读操作:
f = open('./a.txt','w')
print f.read()
f.close()
2,try:
f = open('lujin','w')
print f.read()
finally:
if f:
f.close()
3,
with open('./rw.txt','r') as f:
print f.read()
4,写文件
#w表示文本文件,wb表示二进制文件
import read
import time
f=open('./b.txt','w')
f.write(" i am kaiser!")
f.close()
time.sleep(10)
try:
f = open('./c.txt','r')
print f.read()
finally:
if f:
f.close()