发布时间:2019-08-31 09:44:28编辑:auto阅读(1723)
Python 提供了必要的函数和方法进行默认情况下的文件基本操作
open()函数
语法:
File_object= open(file_name [, access_mode][, buffering])
fp = open("test.txt","w")
fp.write("我是最帮的!!")
fp.close()
结果:
读取文件:
fp = open("test.txt","r")
print fp.readline()
fp.close()
结果
如:
with open("text.txt","r") as pf:
for i in pf:
print i
文件操作模式

上一篇: Python进程学习
下一篇: python实现switch语句
51167
50574
41194
38024
32489
29392
28253
23109
23072
21394
1449°
2170°
1790°
1713°
2021°
1788°
2465°
4150°
4015°
2865°