首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > perl python >

Python怎么读写文本文件

2012-08-02 
Python如何读写文本文件?1. 读取文本文件代码:# coding: utf-8f open(test.txt)print 文件名:, f.na

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




热点排行