python3-cookbook
python3-cookbook copied to clipboard
unescape example @ 2.17 在字符串中处理html和xml not working on Python3.9
Original example
s = 'Spicy "Jalapeño".' 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".' import html p = html p.unescape(s)
ref link: https://github.com/coursera-dl/coursera-dl/issues/778
@xiaobojiang Should we add some "translator comments"?
good idea. we could do it in the footer area, or add a note in below.