将字符串写入文件

with open('somefile.txt', 'a') as f:
    f.write(mytext)

这会将mytext附加到somefile.txt

posted @ 2021-06-01 16:20  poowicat  阅读(141)  评论(0编辑  收藏  举报