python文件操作

文件操作

Note

  • 打开文件
f = open(name[,mode[,buffering]])

打开一个文件简单的方式

f = open("abcd",)

注意,在包含有绝对路径的时候,都会存在的情况,此时就需要字符串转义了。例如:

#读取D:	est.txt的文件,避免文件转义
f = open(r"D:	est.txt","w+")
原文地址:https://www.cnblogs.com/ply616/p/5693535.html