2024-04-20 13:51:47 发布
网友
我有一根绳子:
\xe2\x80\x8e\xd7\x93\xd7\x9c\xd7\x99\xd7\xaa\xe2\x80\x8e
想用python把它改成unicode吗
我该怎么做?在
这个已经是UTF-8数据了;python向您展示了字符串文本形式。在
>>> print '\xe2\x80\x8e\xd7\x93\xd7\x9c\xd7\x99\xd7\xaa\xe2\x80\x8e'.decode('utf8') דלית
上面的代码行将UTF-8数据解码为一个带有.decode('utf8') and prints that; theprintstatement inspects the encoding used by my terminal and re-encodes theunicode`对象的unicode对象,以便我的终端可以正确地显示它。在
.decode('utf8') and prints that; the
statement inspects the encoding used by my terminal and re-encodes the
unicode
您可能需要阅读Python和Unicode:
Python Unicode HOWTO
Pragmatic Unicode作者:Ned Batchelder
The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)作者:Joel Spolsky
这个已经是UTF-8数据了;python向您展示了字符串文本形式。在
上面的代码行将UTF-8数据解码为一个带有
.decode('utf8') and prints that; the
printstatement inspects the encoding used by my terminal and re-encodes the
unicode`对象的unicode
对象,以便我的终端可以正确地显示它。在您可能需要阅读Python和Unicode:
Python Unicode HOWTO
Pragmatic Unicode作者:Ned Batchelder
The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)作者:Joel Spolsky
相关问题 更多 >
编程相关推荐