今天爱分享给大家带来Python如何往文件中追加文本【面试题详解】,希望能够帮助到大家。
with open("test.txt", "a") as myfile: myfile.write("appended text")
可以使用’a’或’a+b’ mode打开文件,见 文档
原文链接:https://blog.itblood.com/4408.html,转载请注明出处。
今天爱分享给大家带来Python如何往文件中追加文本【面试题详解】,希望能够帮助到大家。
with open("test.txt", "a") as myfile: myfile.write("appended text")
可以使用’a’或’a+b’ mode打开文件,见 文档