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
我不明白爲什麼我要回溯。