Python
JayPan2008
在校学生
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Python 2.7.3 将列表中文数据写入文件
#!/usr/bin/env python# coding:utf-8"""将中文列表数据写入到文件的几种方式"""import osfile = open(os.path.abspath('.')+'/output.txt','w')list_cn = ['中文','测试']list_en = ['chinese','test']file.write('********* w原创 2013-03-30 16:26:12 · 16678 阅读 · 1 评论 -
Encoding in python 2.7
# 读取utf-8编码格式的文本文件 # 这里Python解释器读取的是utf-8编码的字节流,然后再按指定的编码方式解释这些字节流# 这样就比较好理解乱码的原因#coding=utf-8 # When Python reads the encoding it tries to interpret the file as utf-8 # 告诉Python解释器编译时采用哪种编码方原创 2013-03-27 14:41:44 · 1867 阅读 · 0 评论
分享