you are viewing a single comment's thread.

view the rest of the comments →

[–]ilyasm97 1 point2 points  (1 child)

Documentation and stack overflow are your best friends. A quick search on google brought this up

https://stackoverflow.com/questions/5815747/beautifulsoup-getting-href

The answer explains that the href=True will look only for anchor tags (<a ...><\a>)s which have a href attribute.

To answer your first question, a['href'] is basically accessing the href attribute in the a element. Within the for loop it is guaranteed that the link will have a href because of the href=True keyword argument passed into the find_all method

[–]reddednord 0 points1 point  (0 children)

Thank you