返回列表 发帖

[问题求助] Python如何把字符串加到文件行首?

fo = open("01.txt","r+")
fo.seek(0, 0)
fo.write('coding.\n')
fo.close()COPY
我已经移动了文件指针了,还是把字符串加到了文件尾。

返回列表