python处理转义字符

python2

#1.
import HTMLParser
HTMLParser.HTMLParser().unescape('Suzy & John')
#2.
from xml.sax.saxutils import unescape
unescape('Suzy & John')

 python3

#python3.3
import html.parser    
html.parser.HTMLParser().unescape('Suzy & John')
#python3.4+
import html
html.unescape('Suzy & John')

猜你喜欢

转载自www.cnblogs.com/konglingxi/p/10754819.html