摘要: 问题 对于一个文本文件,需要在起开头插入一行,其他内容不变 解决方法 ? 1 2 3 4 with open('article.txt', 'r+') as f: content = f.read() f.seek(0, 0) f.write('writer:Fatsheep\n'+content) 阅读全文
posted @ 2020-02-04 23:48 山竹小果 阅读(1161) 评论(0) 推荐(1) 编辑