title: Scraping elements without an id or class from a web page using Python BeautifulSoup
body: <p>I know how to scrape data from a web page if the element has an id or class.</p>
  
  <p>e.g. Here, <code>soup</code> is a BeautifulSoup object.</p>
  
  <pre><code>for item in soup.findAll('a',{"class":"class_name"}):
      title = item.string
      print(title+"\n")
  </code></pre>
  
  <p>How can we do this if the element has no id or class? For example, a paragraph element without an id or class.</p>
  
  <p>Or in an even worse case, what happens if we need to just scrape some plain text like the following?</p>
  
  <pre><code>&lt;body&gt;
  &lt;p&gt;YO!&lt;/p&gt;
  hello world!!
  &lt;/body&gt;
  </code></pre>
  
  <p>How can I print only <code>hello world!!</code> in the above page source, for example?
  It has no id or class.</p>