嗨,我试图提取信息放入一个包含纯文本的列表中,但找不到删除转义字符的方法。在
我对python和编程很陌生。我一直在努力解决这个问题,但找不到。在
这是我的代码:
import urllib
import re
from bs4 import BeautifulSoup
x=1
while x<2:
url = "http://search.insing.com/ts/food-drink/bars-pubs/bars-pubs?page=" +str(x)
htmlfile = urllib.urlopen(url).read()
soup = BeautifulSoup(htmlfile.decode('utf-8','ignore'))
reshtml = soup.find("div", "results").find_all("h3")
reslist = []
for item in reshtml:
res = item.get_text()
reslist.append(res)
print reslist
x += 1
好像你真的很喜欢锚里的文字,考虑换一下
收件人:
^{pr2}$同时改变:
收件人:
以下是我换衣服后得到的:
当前输出如下所示:
在打印前添加以下行:
^{pr2}$给我这个输出:
这就是你要找的吗?在
盖伊的回答更好,而且更具体。在
相关问题 更多 >
编程相关推荐