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

python 以 utf-8 格式写文件

时间:2015-08-18 18:21:53      阅读:104      评论:0      收藏:0      [点我收藏+]

标签:

import codecs
f = codecs.open(test.txt, w, utf-8)
f.write(中文)
f.close()

运行结果:

技术分享

python 以 utf-8 格式写文件

标签:

原文地址:http://www.cnblogs.com/cuixiaochen/p/4739721.html

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