title: Getting the first element of a bs4.element.ResultSet object
body: <p>So, I'm trying to get informations about a website using BeautifulSoup. The thing is, using findAll() I get a bs4.element.ResultSet object and I have to loop through it to get its elements. But I'm pretty sure I will get only one tag of it and I don't want to loop through a set which has only one element in it.</p>
  
  <p>So my question is how do I get only the first and probably the unique element of a bs4.element.ResultSet object?</p>
  
  <pre><code>&lt;div class="textinfo"&gt;
     &lt;div class="author"&gt;A tale of &lt;span&gt;&lt;a href="/profile/89965"&gt;Edgar Allan Poe&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
     &lt;div class="category"&gt;Category: Horror&lt;/div&gt;
     &lt;div class="date"&gt;Date: 27/11/2008&lt;/div&gt;
     &lt;div class="votes"&gt;Votes &lt;a href="/text/200811799/votes"&gt;&lt;span id="votesmedia"&gt;10.00&lt;/span&gt;&lt;/a&gt; &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>These methods are inside a class thats why I'm using 'self'.</p>
  
  <pre><code>def getTales(self):
      talesLinks = self.file.readLinks(self.file.talePath)
      driver = browser.connectChrome()
  
      for link in talesLinks:
          headerTale = []
          driver.get(link)
          page_source = driver.page_source
          soup = BeautifulSoup(page_source, 'html.parser')
  
          #Probably I'll get only one div 'textinfo' for each link.
          header = soup.findAll('div', {'class': 'textinfo'})
          self.getHeaderInfo(header, headerTale)
  
      driver.quit()
      print("chrome headless closed")
  
  def getHeaderInfo(self, header, headerTale):
  
      # I don't want to loop because I know 'header' has only one element.
      for author in headerTale:
          author = header.findAll('div', {'class', 'author'})
          #...
          #...
  </code></pre>