On Mon, Mar 5, 2018 at 2:35 AM, <
geoffroy...@gmail.com> wrote:
> from urllib.request import urlopen
> from bs4 import BeautifulSoup
> html = urlopen("
https://www.legifrance.gouv.fr")
> bsObj = BeautifulSoup( html)
> for link in bsObj.findAll(" a"):
> if 'href' in link.attrs:
> print( link.attrs[' href'])
I am not certain I understand your question. Or if your posting to
the list has changed how your code is rendered. But note that spacing
within strings is significant. Do you get your intended result if you
do:
> for link in bsObj.findAll("a"):
> if 'href' in link.attrs:
> print( link.attrs['href'])
(note the change in spacing for the tag and attribute name).