pandaomeng / gitalk-comment

使用gitalk存储博客的评论
0 stars 0 forks source link

python3 unicode 编码 | Hexo #8

Open pandaomeng opened 5 years ago

pandaomeng commented 5 years ago

http://www.pandaomeng.com/2018/12-26-python3-unicode/

python3 编码 unicode码在python里有两种表示方式: u’字符串’或者’\u四位十六进制数’。它们是等价的,而且都是str对象。 栗子: 12345678a = u'中国'b = '\u4E2D\u56FD'c = '\u4E2D\u56FD'print(type(a), a)print(type(b), b)print(type(c), c)print('a == b:',