Python如何读写文本文件?
1. 读取文本文件代码:
# coding: utf-8f = open('test.txt')print '文件名:', f.nameprint '是否处于关闭状态:', f.closedprint '打开的模式:', f.mode运行结果:root@he-desktop:~/python/example# python read_info.py 文件名: test.txt是否处于关闭状态: False打开的模式: r
发布时间: 2012-08-02 11:35:25 作者: rapoo
Python如何读写文本文件?
1. 读取文本文件代码:
# coding: utf-8f = open('test.txt')print '文件名:', f.nameprint '是否处于关闭状态:', f.closedprint '打开的模式:', f.mode