您如何附加到文件? [英] How do you append to a file?

查看:59
本文介绍了您如何附加到文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您如何附加到文件而不是覆盖文件?有附加到文件的特殊功能吗?

How do you append to the file instead of overwriting it? Is there a special function that appends to the file?

推荐答案

with open("test.txt", "a") as myfile:
    myfile.write("appended text")

这篇关于您如何附加到文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆