Oct-19-2019, 10:28 AM
Hello
I am trying to scrape a table data using the code below .I am trying to scrape the names of all states of USA .I ve managed to extract all 'a'tags but they include all data within a tags .How can i scrape only the names of USA states?
I am trying to scrape a table data using the code below .I am trying to scrape the names of all states of USA .I ve managed to extract all 'a'tags but they include all data within a tags .How can i scrape only the names of USA states?
import bs4 import requests res = requests.get('https://simple.wikipedia.org/wiki/List_of_U.S._states') soup = bs4.BeautifulSoup(res.text, 'lxml') soup.select('a') for i in soup.select('a'): print(i.text)