python文件读和写


fileHandle = open ( 'G:/qqfile/1.txt','w' )
fileHandle.write('abcd')
#写文件 地址要用反斜杠
fileHandle.close()

fileHandle = open ( 'G:/qqfile/1.txt' )
print (fileHandle.read() )
fileHandle.close()
#读文件
原文地址:https://www.cnblogs.com/china520/p/10396419.html