37,721
社区成员
发帖
与我相关
我的任务
分享
>>> import html.parser
>>> h = html.parser.HTMLParser()
>>> s = h.unescape('© 2010')
>>> s
u'\xa9 2010'
>>> print s
© 2010
>>> s = h.unescape('© 2010')
>>> s
u'\xa9 2010'
>>> '袈'.encode("unicode-escape")
b'\\u8888'
>>> chr(int('8888', 16))
'袈'
>>> h.unescape('♥')
'♥'
>>> h.unescape('♥')
'♥'
>>> h.unescape('♥')
'♥'
>>> '♥'.encode("unicode-escape")
b'\\u2665'
>>> chr(int('2665', 16))
'♥'
>>> import html.entities as h
>>> h.name2codepoint['hearts']
9829