python编码各种问题(更新中)

  • python2 \u8fd9\u662f 格式数据转为可用的中文
    '''
    s = '\u8fd9\u662f'
    print type(s) # <type 'str'>
    print s.decode('unicode-escape').encode('utf-8') # 这是 (先转成unicode,再转为str)
    '''
posted @ 2021-12-09 18:03  白大总管  阅读(11)  评论(0)    收藏  举报