line = line.strip () TypeError: el objeto 'NoneType' no es invocable
Estoy tratando de encontrar todos los números en una lista de un html usandobeautifulsoup
:
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`
Estoy recibiendo un rastreo:
Rastreo (última llamada más reciente): Archivo "C: \ Documents and Settings \ mea388 \ Desktop \ PythonSchool \ new 12.py", línea 14, en línea = line.strip () TypeError: el objeto 'NoneType' no es invocable
No puedo entender por qué estoy obteniendo un rastreo.