title: Beautifulsoup scraping specific table in page with multiple tables
body: <pre><code>import requests
  from bs4 import BeautifulSoup
  
  results = requests.get(&quot;https://en.wikipedia.org/wiki/List_of_multiple_Olympic_gold_medalists&quot;)
  
  src = results.content
  
  soup = BeautifulSoup(src, 'lxml')
  
  trs = soup.find_all(&quot;tr&quot;)
  for tr in trs:
      print(tr.text)
  </code></pre>
  <p>This is the code I write for the scraping table from the page &quot;https://en.wikipedia.org/wiki/List_of_multiple_Olympic_gold_medalists&quot;</p>
  <p>If I am only targeting the table in the session &quot;List of most Olympic gold medals over career&quot;, how can I specify the table I need? There are 2 sortable <code>jquery-tablesorter</code> so I cannot use the class attribute to select the table I needed.</p>
  <p>One more question, if I know that the page I am scraping contains a lot of tables and the one I need always have 10 <code>td</code> in 1 <code>row</code>, can I have something like</p>
  <pre><code>If len(td) == 10:
  print(tr)
  </code></pre>
  <p>to extract the data I wanted</p>
  <p>Update on code:</p>
  <pre><code>from bs4 import BeautifulSoup
  
  results = requests.get(&quot;https://en.wikipedia.org/wiki/List_of_multiple_Olympic_gold_medalists&quot;)
  
  src = results.content
  
  soup = BeautifulSoup(src, 'lxml')
  
  tbs = soup.find(&quot;tbody&quot;)
  trs = tbs.find_all(&quot;tr&quot;)
  for tr in trs:
      print(tr.text)
  </code></pre>
  <p>I have one of the solution, not a good one, just to extract the first table from the page which is the one I needed, any suggestion/ improvement are welcomed!</p>
  <p>Thank you.</p>