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

推荐订阅源

Forbes - Security
Forbes - Security
GbyAI
GbyAI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
SegmentFault 最新的问题
Y
Y Combinator Blog
Recorded Future
Recorded Future
博客园 - Franky
I
InfoQ
T
The Blog of Author Tim Ferriss
Recent Announcements
Recent Announcements
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
T
Tailwind CSS Blog
Cyberwarzone
Cyberwarzone
The Register - Security
The Register - Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
雷峰网
雷峰网
P
Palo Alto Networks Blog
G
GRAHAM CLULEY
Cloudbric
Cloudbric
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
MongoDB | Blog
MongoDB | Blog
F
Full Disclosure
Google DeepMind News
Google DeepMind News
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Check Point Blog
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
T
Threat Research - Cisco Blogs
U
Unit 42
N
Netflix TechBlog - Medium
The Cloudflare Blog
Spread Privacy
Spread Privacy
Microsoft Azure Blog
Microsoft Azure Blog
美团技术团队
T
Troy Hunt's Blog
Engineering at Meta
Engineering at Meta
H
Heimdal Security Blog
TaoSecurity Blog
TaoSecurity Blog
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tenable Blog
B
Blog
S
Securelist
H
Hacker News: Front Page
Google Online Security Blog
Google Online Security Blog
G
Google Developers 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)    收藏  举报

刷新页面返回顶部