import requests
from bs4 import BeautifulSoup
import csv
r=requests.get('https://en.wikipedia.org/wiki/NIFTY_50')
data=r.text
soup=BeautifulSoup(data,'html.parser')
x=8
while (True):
html=soup.select('td')[x]
text=html.get_text()
x+=3
with open('symbol.txt','a',newline='\n') as wr1:
wr=csv.writer(wr1)
for row in html:
wr.writerow([text])
if(x==170):
break