unicode 转换 -- python

    科技2022-07-10  154

    str = u'上海' uni = str.encode('unicode-escape') uni Out[55]: b'\\u4e0a\\u6d77' uni.decode() Out[56]: '\\u4e0a\\u6d77' print(uni) b'\\u4e0a\\u6d77'

     

    str = '\\u6bd5\\u8282\\u5730\\u533a' str.encode('utf-8').decode('unicode_escape')

     

    Processed: 0.009, SQL: 8