Given a website, I want to use python regular expression to get the data out from the web page.
Although I can use other packages, my requirement is only to use regular expression to get the required data from webpage.
If I want to find the Mexican restaurants in Dalals, I go to this link
https://www.yelp.com/search?find_desc=Re...2C+TX&ns=1
From here I want to find (from the first page) the restaurant name, its ranking, its number of reviews etc.
This information will be stored in the list of dictionaries.
My program looks like as follows but I m stuck on how to loop / how to find the required data.
Although I can use other packages, my requirement is only to use regular expression to get the required data from webpage.
If I want to find the Mexican restaurants in Dalals, I go to this link
https://www.yelp.com/search?find_desc=Re...2C+TX&ns=1
From here I want to find (from the first page) the restaurant name, its ranking, its number of reviews etc.
This information will be stored in the list of dictionaries.
My program looks like as follows but I m stuck on how to loop / how to find the required data.
import urllib.request from re import findall import re url = "https://www.yelp.com/search?find_desc=Restaurants+Mexican&find_loc=Dallas%2C+TX&ns=1" response = urllib.request.urlopen(url) html = response.read() htmlStr = html.decode()