惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
Microsoft Security Blog
Microsoft Security Blog
云风的 BLOG
云风的 BLOG
B
Blog
The Register - Security
The Register - Security
L
LangChain Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
N
Netflix TechBlog - Medium
F
Full Disclosure
The GitHub Blog
The GitHub Blog
Recorded Future
Recorded Future
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Blog — PlanetScale
Blog — PlanetScale
Jina AI
Jina AI
美团技术团队
宝玉的分享
宝玉的分享
Hugging Face - Blog
Hugging Face - Blog
阮一峰的网络日志
阮一峰的网络日志
G
Google Developers Blog
大猫的无限游戏
大猫的无限游戏
S
SegmentFault 最新的问题
D
DataBreaches.Net
Martin Fowler
Martin Fowler
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - Franky
The Cloudflare Blog
博客园 - 【当耐特】
U
Unit 42
月光博客
月光博客
T
The Blog of Author Tim Ferriss
博客园 - 叶小钗
博客园 - 聂微东
I
InfoQ
B
Blog RSS Feed
Apple Machine Learning Research
Apple Machine Learning Research
Cyberwarzone
Cyberwarzone
V
V2EX
S
Securelist
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
Security @ Cisco Blogs
PCI Perspectives
PCI Perspectives
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Heimdal Security Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Hacker News
The Hacker News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
Tor Project blog

博客园 - 夏日微风

mysql备份和恢复命令 urllib2下载时判断网页编码 使用setuptools自动安装python模块 Python的MySQL库 php2python WordPress安装步骤 centos 5.6 升级php到5.3 vsftp 的默认目录位置 Linux Develop Notes Linux Command Notes C#格式化数值结果表 - 夏日微风 - 博客园 证监会新年联欢会节目单(征求意见稿) 在.NET中打开ODBC“选择数据源”对话框 命案十三宗 看港剧,学穿衣 - 欧阳震华 看港剧,学穿衣 - 张家辉 - 胖矮个 看港剧,学穿衣 - 林保怡 - 小矮个 看港剧,学穿衣 - 罗嘉良 - 土蛋 看港剧,学穿衣 - 苏永康 - 斯文丑男
Python中文支持小结
夏日微风 · 2011-05-16 · via 博客园 - 夏日微风
  • 源码文件保存的时候,需要用UTF-8编码
  • 文件头添加编码标记:
    # coding=UTF-8

  • UTF-8和其他格式编码的互换,可以使用 decode 和 encode 函数
    encode是将UTF-8字符串转变为其他编码的串,decode是将其他编码串转换为UTF-8串
    例如,text 是一个包含 GB2312 编码内容的字符串,可以用下述代码将其转换为 UTF-8 编码:
    text.decode(“GB2312”)

  • 使用正则表达式时,记得用上  re.UNICODE 选项

posted on 2011-05-16 20:31  夏日微风  阅读(318)  评论(0)    收藏  举报

刷新页面返回顶部