#!/usr/bin/python
__author__ = 'huangpeng03'
def FileInputStream(filename):
try:
f = open(filename)
for line in f:
for byte in line:
yield byte
except StopIteration as e:
f.close()
def FileOutputStream(ins, filename):
try:
f = open(filename, 'w')
while True:
byte = ins.next()
f.write(byte)
except StopIteration as e:
print e
if __name__ == '__main__':
FileOutputStream(FileInputStream('hello.txt'), 'hello2.txt')
Python模拟java输入输出流
最新推荐文章于 2023-03-15 15:07:24 发布