def getPeopleLinks(page):
links = []
for link in page.find_all('a'):
url = link.get('href')
if url:
if 'profile/view?id=' in url:
links.append(url)
return links
def getID(url):
pUrl = urlparse(url)
return pUrl.id
从下面执行
people = getPeopleLinks(page)
if people:
for person in people:
ID = getID(person)
当我执行它时,我收到此错误:
return pUrl.id
AttributeError: 'ParseResult' object has no attribute 'id'