[Tutor] using BeautifulSoup

Kent Johnson kent37 at tds.net
Tue Mar 28 03:38:37 CEST 2006


jonasmg at softhome.net wrote:
> anchor.findNext('code') fails: 
> 
> anchor = soup.fetch('a', {'href': '/wiki/List_of_country_calling_codes'})
> print anchor 
> 
>  [<a href="/wiki/List_of_country_calling_codes" title="List of country
> calling codes">Calling code</a>] 
> 
> anchor.findNext('code')
> [] 

are you sure that's what you got? Looks like an AttributeError to me - 
anchor is a *list* of anchors. Try
anchor[0].findNext('code')

Kent



More information about the Tutor mailing list