[Tutor] extract uri from beautiful soup string

eryksun eryksun at gmail.com
Tue Oct 16 15:48:07 CEST 2012

On Tue, Oct 16, 2012 at 7:52 AM, Norman Khine <norman at khine.net> wrote:
> thanks, i made the changes https://gist.github.com/3891927

On line 67, use the result of soup.findAll directly:

    assoc_data.extend(assoc_cont.renderContents() for assoc_cont in
        soup.findAll('td', {'width': '49%', 'class': 'menu2' }))

On line 72, can't the result of findAll() be subscripted, if you only
want the first item? For example:

    assoc_tel = soup.findAll('td', {'width': '45%', 'class': 'menu2'})

On line 80 you can use writerows instead:

    with open('nimes_assoc.csv', 'wb') as f:

More information about the Tutor mailing list