0
我试图用beautifulsoup
找到从HTML列表中的所有NUM的:线= line.strip()类型错误:“NoneType”对象不是可调用
import urllib
from BeautifulSoup import *
import re
line = None
url = raw_input('Enter - ')
html = urllib.urlopen(url).read()
soup = BeautifulSoup(html)
# Retrieve all of the anchor tags
tags = soup('span')
for line in tags:
line = line.strip()
numlist = re.findall('[0-9]+' , tags)
print numlist`
我得到一个回溯:
Traceback (most recent call last): File "C:\Documents and Settings\mea388\Desktop\PythonSchool\new 12.py", line 14, in line = line.strip() TypeError: 'NoneType' object is not callable
我不明白为什么我要回溯。