2
我正在使用python 2.7.12 我有一個字符串,它包含unicode文字,它不是Unicode類型。我想將其轉換爲文本。這個例子解釋了我想要做的。Python 2.7,將utf8字符串轉換爲ascii
>>> s
'\x00u\x00s\x00e\x00r\x00n\x00a\x00m\x00e\x00'
>>> print s
username
>>> type(s)
<type 'str'>
>>> s == "username"
False
我該如何去轉換這個字符串?