一、读取文件内容:
def readFile(path):
with open(path,"rt") as f:
return f.read()
二、写入文件内容:
def writeFile(path,contents):
with open(path, "wt") as f:
f.write(contents)
注意:path用//而非\
一、读取文件内容:
def readFile(path):
with open(path,"rt") as f:
return f.read()
二、写入文件内容:
def writeFile(path,contents):
with open(path, "wt") as f:
f.write(contents)
注意:path用//而非\