title: How do I get the second table class?
body: <p>I am trying to find a table in a Wikipedia page using BeautifulSoup. I know how to get the first table, but how do I get the second table (Recent changes to the list of S&amp;P 500 Components) with the same class <code>wikitable sortable</code>?</p>
  
  <p>my code:</p>
  
  <pre><code>import bs4 as bs
  import requests
  
  url='https://en.wikipedia.org/wiki/List_of_S%26P_500_companies'
  r=requests.get(url)
  url=r.content
  soup = bs.BeautifulSoup(url,'html.parser')
  
  tab = soup.find("table",{"class":"wikitable sortable"})
  </code></pre>
  
  <p><a href="https://en.wikipedia.org/wiki/List_of_S%26P_500_companies" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/List_of_S%26P_500_companies</a></p>