python3-cookbook icon indicating copy to clipboard operation
python3-cookbook copied to clipboard

unescape example @ 2.17 在字符串中处理html和xml not working on Python3.9

Open xiaobojiang opened this issue 4 years ago • 2 comments

Original example

s = 'Spicy "Jalapeño&quot.' from html.parser import HTMLParser p = HTMLParser() p.unescape(s) 'Spicy "Jalapeño".'

after Python 3.9, 'HTMLParser' object has no attribute 'unescape', this method is removed.

a working example of Python 3.9 : s = 'Spicy "Jalapeño&quot.' import html p = html p.unescape(s)

ref link: https://github.com/coursera-dl/coursera-dl/issues/778

xiaobojiang avatar Jan 21 '21 08:01 xiaobojiang

@xiaobojiang Should we add some "translator comments"?

zlu27 avatar Feb 20 '21 05:02 zlu27

good idea. we could do it in the footer area, or add a note in below.

xiaobojiang avatar Feb 22 '21 01:02 xiaobojiang