Python处理中文字符
2015-08-06 17:53
519 查看
从中文文件中读取字符
import codecs #写文件 writer = codecs.open('p2p.txt', 'w', 'utf-8') 。。。。。。。。。 。。。。。。。。。 writer.close() #读文件 reader = codecs.open('p2p.txt', 'r', 'utf-8') 。。。。。。。。。 。。。。。。。。。 reader.close()
在脚本中添加
#coding=utf-8
相关文章推荐
- python创建多进程
- python 入门神图
- python练习题(四)
- python 的日志logging模块学习
- 机器学习实战(python)一 k临近算法。
- 【Python】生成器和迭代器
- python 连接超时判断subprocess
- 用Python抓取全站中的404错误
- Python 2 与Python 3的区别
- Windows 下针对python脚本做一个简单的进程保护
- python独立脚本调用django settings
- ArcGIS制作Python脚本时字符编码问题
- python处理HTML转义字符
- Python 时间格式化
- python
- python中__new__ 的作用
- python中**dict
- Python的私有化
- python函数
- Python调用c扩展记录——ctype