0

如何在 python 2.7 中strunichrin连接Jupyter IPython?正如我尝试过的那样。

string = 'blah blah'
unicode_char = unichr(169)
end_str = string + unicode_char
end_str

会扔到u'blah blah\xa9'我想显示的地方blah blah©

4

1 回答 1

0

In Python 2 the strings are bytes and when you add a byte out of ASCII scope the string represents it as \x and a hexadecimal code. But if you call your unicode string from print it will show de unicode caracter, in your case a copyright symbol.

print end_str
于 2018-01-25T08:36:06.340 回答