【Rollo的Python之路】Python 编码与解码

Python 编码与解码:

1.0 解码:encoding = 'utf-8/utf8/UTF-8/UTF8',要想解码,必须知道用什么方式编码的。

with open('test','r',encoding = 'utf-8') as e:
    print(e.read())

 2.0 Python 2 存的是bytes与unicode数据类型,Python 3 是str unicode

 

posted @ 2019-06-01 21:01  Rollo|St  阅读(135)  评论(0编辑  收藏  举报