代码:
import os
file=open("a1.txt","w")
print "file name:",file.name
print "is closed:",file.closed
f
=open("a2.txt","w+")
f
.write
("hello,world")
s
=f
.read
()
print s
os
.rename
("a1.txt","a.txt")
os
.remove
("a.txt")
os
.remove
("a2.txt")
运行结果:
file name
: a1
.txt
is closed
: False
hello
,world
转载请注明原文地址: https://lol.8miu.com/read-24146.html