#输入流
def FileInputStream(filename):
try:
f = open(filename)
for line in f:
for byte in line:
yield byte
except StopIteration,e:
f.close()
return
#输出流
def FileOutputStream(inputStream,filename):
try:
f = open(filename,"w")
while True:
byte = inputStream.next()
f.write(byte)
except StopIteration,e:
f.close()
return
if __name__ == "__main__":
FileOutputStream(FileInputStream("hello.txt"),"hello2.txt")
阅读(2314) | 评论(0) | 转发(0) |