您的位置:首页 > 编程语言 > Python开发

python 文件操作

2010-07-28 17:58 295 查看
 

简明 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()
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  python fun file