Tôi đang gặp rắc rối hiển thị nội dung, chương trình của tôi :Thay đổi & # 39 vào nhân vật bình thường
#! /usr/bin/python
import urllib
import re
url = "http://yahoo.com"
pattern = '''<span class="medium item-label".*?>(.*)</span>'''
website = urllib.urlopen(url)
pageContent = website.read()
result = re.findall(pattern, pageContent)
for record in result:
print record
đầu ra:
Masked teen killed by dad
First look in 'Hotel of Doom'
Ex-NFL QB's sad condition
Reporter ignores warning
Romney's low bar for debates
Vậy câu hỏi là những gì tôi nên đưa vào trong mã của tôi trong để chuyển đổi & # 39 thành các ký tự
có thể nhân đôi với http://stackoverflow.com/questions/57708/convert-xml-html-entities-into-unicode- string-in-python – charlee