title: Webscraping - Beautifulsoup4 - Accessing indexed item in a find_all loop
body: <p>How do I make it so that I can choose an item in the list in that for loop?</p>
  <p>When I print it without brackets, I get the full list and every index seems to be the proper item that I need</p>
  <pre><code>for h3 in soup.find_all('h3', itemprop=&quot;name&quot;):
      bookname = h3.a.text
      bookname = bookname.split('\n')
      print(bookname)
  </code></pre>
  <p>However, when I print it by specifying an index, whether it is inside the loop or outside, it returns &quot;list index out of range&quot;</p>
  <pre><code>for h3 in soup.find_all('h3', itemprop=&quot;name&quot;):
      bookname = h3.a.text
      bookname = bookname.split('\n')
      print(bookname[2])
  </code></pre>
  <p>What's my problem here? How do I change my code so that I can scrape all the h3 names, yet at the same time be able to choose specific indexed h3 names when I want to?</p>
  <p>Here's the entire code:</p>
  <pre><code>import requests
  from bs4 import BeautifulSoup
  
  source = requests.get(&quot;https://ca1lib.org/s/ginger&quot;) #gets the source of the site and returns it
  soup = BeautifulSoup(source.text, 'html5lib')
  
  for h3 in soup.find_all('h3', itemprop=&quot;name&quot;):
      bookname = h3.a.text
      bookname = bookname.split('\n')
      print(bookname[2])
  </code></pre>