简明 Python 教程 中的例子,python 运行出错,用open代替file()。可以运行。
poem='''/
Programming is fun
When the work is done
if you wanna make your work also fun:
use Python!
'''
f=open('E://test.txt','w')
f.write(poem)
f.close()
f=open('E://test.txt','r')
while True:
line=f.readline()
if len(line) == 0:
break;
print (line)
f.close()