file = open("newfile.txt", "w") file.write("写入字符串在文件里") file.close() file = open("newfile.txt", "r") print(file.read()) file.close() 结果 >>> 写入字符串在文件里 >>>
0