码迷,mamicode.com
首页 > 编程语言 > 详细

python保存字符串到txt文件

时间:2020-02-04 23:38:54      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:python   alt   pytho   ber   ring   word   字符   保存   pen   

str = (‘123456‘)
fh = open(‘666.txt‘, ‘w‘, encoding=‘utf-8‘)
fh.write(str)
fh.close()

python保存字符串到txt文件

标签:python   alt   pytho   ber   ring   word   字符   保存   pen   

原文地址:https://www.cnblogs.com/ywheunji/p/12261900.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!