这是一个beautifulsoup
在所有<p>
html 标记中抓取内容的过程。从某些网页抓取内容后,我收到一条错误消息,提示超出最大递归深度。
def printText(tags):
for tag in tags:
if tag.__class__ == NavigableString:
print tag,
else:
printText(tag)
print ""
#loop over urls, send soup to printText procedure
跟踪的底部:
File "web_content.py", line 16, in printText
printText(tag)
File "web_content.py", line 16, in printText
printText(tag)
File "web_content.py", line 16, in printText
printText(tag)
File "web_content.py", line 16, in printText
printText(tag)
File "web_content.py", line 16, in printText
printText(tag)
File "web_content.py", line 13, in printText
if tag.__class__ == NavigableString:
RuntimeError: maximum recursion depth exceeded in cmp