Python编码
来源:互联网 发布:阿里云 dnspod 编辑:程序博客网 时间:2024/06/03 18:09
# -*- coding:UTF-8 -*-def read_code(): # 字符串在Python内部的表示是Unicode编码,因此,在编码转换时,通常需要以Unicode作为中间编码, # 先将其他编码的字符串解码(decode)成Unicode,再从Unicode编码(encode)成另一种编码。 # decode的作用:将其他编码转换成Unicode编码 str.decode('gb2312') # 将gb2312编码的字符串str转换为Unicode编码 # encode的作用:将Unicode编码转换成其他编码 str.encode('gb2312') # 将Unicode编码的字符串str转换为gb2312编码if __name__ == "__main__": read_code()
0 0
- 系统编码 python编码
- 【编码】Python编码
- PYTHON 编码
- python 编码
- python 编码
- python 编码
- python 编码
- Python 编码
- python编码
- python 编码
- Python编码
- python编码
- python 编码
- python编码
- python 编码
- python编码
- python 编码
- python编码
- word2013中公式居中编号右对齐
- Object-Oriented Analysis and Design Using UML 翻译与学习 (六)
- 时钟类
- Python字典排序
- 五月一战
- Python编码
- 如何在Anaconda下安装MySQLdb,操作系统为Centos Linux, Python 2.7
- 技术面面试总结1
- sparksql udf自定义函数中参数过多问题的解决
- Android API 19以上版本自带的下拉刷新控件SwipeRefreshLayout的使用
- codevs 1006 等差数列 题解报告
- websphere8.5+LDAP+ear war包发布成功,能访问到登录页面,输入用户名密码登录不了
- 软件开发模型对比
- Java之值传递Or引用传递?