url21 = "https://www.ft.com/search?sort=date&q=eurozone"
with open(savePath + "Euro_FT" + date + ".txt","wt",-1,'utf-8') as f1:
ht2 = req.urlopen(url21)
soup2 = BeautifulSoup(ht2,'html.parser')
contents = soup2.select('div.o-teaser__heading > a')[0:]
for i, contents in enumerate(contents,1):
f1.write(str(i) + " " + contents.string + "\n")
我已经使用上面提到的python代码超过6个月了,
突然我收到了错误消息TypeError: can only concatenate str (not "NoneType") to str
我试图通过stackoverflow问答找到一些答案,但案例和答案与我的案例有点不同。在
我使用了for
,而不是{
我已经找了一个多小时了。。但我找不到答案。。。在
目前没有回答
相关问题 更多 >
编程相关推荐