I am very new to web scraping. I am learning web Scraping online.
website i am trying to scrape is http://econpy.pythonanywhere.com/ex/001.html
i have written a code that will scrape
Q1: when i run this code using buyer info it prints price,how to get the data of next pages also?
Q2: why it doesn't print price , when run individually(just buyername)?
Q3: how to write these data into CSV?
website i am trying to scrape is http://econpy.pythonanywhere.com/ex/001.html
i have written a code that will scrape
from bs4 import BeautifulSoup from urllib.request import urlopen url = urlopen("http://econpy.pythonanywhere.com/ex/001.html") def getTitle(): global url bs0bj = BeautifulSoup(url, "html.parser") for i in bs0bj.find_all(title="buyer-name"): print(i.get_text()) getTitle() #def getTitle(): # global url # bs0bj = BeautifulSoup(url, "html.parser") # for i in bs0bj.find_all(title="buyer-info"): # print(i.get_text()) #getTitle() def getPrice(): global url bs0bj = BeautifulSoup(url, "html.parser") for i in bs0bj.find_all("span", {"class":"item-price"}): print(i.get_text()) getPrice()now there are few questions:(please uncomment the codes)
Q1: when i run this code using buyer info it prints price,how to get the data of next pages also?
Q2: why it doesn't print price , when run individually(just buyername)?
Q3: how to write these data into CSV?