Quick reference

You can view the following references to get an overview of creating the following objects:

  • BeautifulSoup
    • soup = BeautifulSoup(string)
    • soup = BeautifulSoup(string,features="xml") #for xml
  • Tag
    • tag = soup.tag #accessing a tag
    • tag.name #Tag name
    • tag['attribute'] #Tag attribute
  • NavigableString
    • soup.tag.string #get Tag's string

Get Getting Started with Beautiful Soup now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.