python编码转换

March 27, 2016, 11:18 a.m.

windows命令行默认编码gbk


将gbk转换为Unicode编码:

    a = a.decode('gbk')

将Unicode编码转换为utf8编码:

    a = a.encode('utf-8')

将utf-8编码转换为url编码:

     import urllib

     urllib.quote(a)


评论(0)

评论暂缺

添加新评论