I am unable to remove the tab spaces from the web data, which I want to enter into an excel sheet.
import requests as r
from bs4 import BeautifulSoup
url='https://www.screener.in/screens/41109/all-stocks/?limit=100&page=1'
response = r.get(url)
soup=BeautifulSoup(response.text, 'html.parser')
table=soup.find_all('table')
table_len=soup.find_all(len('table'))
scrnr_table=soup.find_all('th')
header_tags=[header.text.strip('n') for header in scrnr_table]
data_rows = soup.find_all('tr')
row_values = [dr.text.strip() for dr in data_rows]
for header in header_tags:
h_values=header.strip('n')
print(header)
New contributor
Shiv Kumar V is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.