Writing to a file (python)
This question already has an answer here:
use
f = open('masters.txt', 'a')
instead
EDIT: see here
f = open('masters.txt', 'a')
Opening the file in 'w' mode deletes everything and then writes new stuff. I've learned it the hard way ;)
Anyway, you should open it in 'a' mode (append), which would look like this:
f = open("masters.txt", 'a')
f.writelines(args, "n")
f.close()
链接地址: http://www.djcxy.com/p/42400.html
上一篇: 使用Python写入文件
下一篇: 写入文件(python)