Nov-30-2020, 07:06 PM
Hello;
I am new to Python,
I am trying to scrape a website using search keywords from a list (text file), loop through each line of keywords until each and every keyword in the file has been searched.
the search block of code works and prints the result.
Here is my code:
Can anyone help me with this code, please?
I am new to Python,
I am trying to scrape a website using search keywords from a list (text file), loop through each line of keywords until each and every keyword in the file has been searched.
the search block of code works and prints the result.
Here is my code:
driver.get('https://www.website.com/?q=dog%20care') html = driver.page_source soup = BeautifulSoup(html, 'html.parser') a = soup.select('div.class_name a') for a in soup.select('div.class_name a'): print(a['title']) # read file sction: with open ("keyword_list.txt", "r") as f: for line in f: print(line.strip()))the read file block of code works, but I am not sure how to make it work together with the search function.
Can anyone help me with this code, please?