3
所以我的代码看起来是这样的.... 的,但我想一直将数据添加到文件 结束时,我会怎么做这将数据添加到结束现有的文件蟒蛇
try:
f = open("file.txt", "w")
try:
f.write('blah') # Write a string to a file
f.writelines(lines) # Write a sequence of strings to a file
finally:
f.close()
except IOError:
pass
** Re ** open?如果他之前用'w'打开它,它已经是空的了。 – ThiefMaster 2012-01-15 15:29:36