title: How to extract td value from webage using Python?
body: <p>I'm pretty much brand new to Python, but I'm looking to build a web-scraping tool that will rip data from an HTML table online and print it into a CSV in the same format.</p>
  <p>I am trying to scrape data from web page. But it is giving me empty array though the data is present in it. How to extract that data?</p>
  <pre><code>enter code here
  
  import pandas as pd
  import matplotlib.pyplot as plt
  import seaborn as sns
  
  from urllib.request import urlopen
  
  from bs4 import BeautifulSoup
  
  url = &quot;https://www.forbes.com/global2000/list/#tab:overall&quot;
  page = urlopen(url)
  
  soup = BeautifulSoup(page)
  text = soup.get_text()
  print(soup.prettify())
  
  all_tables=soup.find_all('tbody')
  print(all_tables)
  right_table=soup.find('tbody',{&quot;class&quot;:'list-item-template'})
  
  A=[]
  B=[]
  C=[]
  D=[]
  E=[]
  F=[]
  G=[]
  H=[]
  for row in right_table.findAll(&quot;tr&quot;):
      cells = row.findAll('td')
      print(len(cells))
      states=row.findAll('th') #To store second column data
      if len(cells)==8: #Only extract table body not heading
          A.append(cells[0].find(text=True))
          # B.append(states[0].find(text=True))
          B.append(cells[1].find(text=True))
          C.append(cells[2].find(text=True))
          D.append(cells[3].find(text=True))
          E.append(cells[4].find(text=True))
          F.append(cells[5].find(text=True))
          G.append(cells[6].find(text=True))
          H.append(cells[7].find(text=True))
  
  
  df=pd.DataFrame(A,columns=['IMAGE'])
  df['RANK']=B
  df['NAME']=C
  df['COUNTRY']=D
  df['REVENUE']=E
  df['PROFITS']=F
  df['ASSETS']=G
  print(df)
  </code></pre>
  <p>I am getting this output:</p>
  <p><a href="https://i.stack.imgur.com/v4wxo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v4wxo.png" alt="enter image description here" /></a></p>