After the great support of @αԋɱҽԃ αмєяιcαη I have the following code
import requests
from bs4 import BeautifulSoup
import pandas as pd
masterlist = []
def main(url):
with requests.Session() as req:
for item in range(1, 2):
r = req.get(url.format(item))
print(r.url)
soup = BeautifulSoup(r.content, 'html.parser')
s in soup.findAll('p', class_='star-rating')
goal = [(x.h3.a['title'], x.select_one("p.price_color").text, x.select_one("p.star-rating")['class'][-1], 'http://books.toscrape.com' + x.a.img['src'].replace('..',''))
for x in soup.select("li.col-xs-6")]
#print(goal)
masterlist.append(goal)
main("http://books.toscrape.com/catalogue/page-{}.html")
pd = df.DataFrame(masterlist)
df
The result is perfect. Now I need to learn how to export the results to excel file? Forgive me as I am trying to learn step by step. I think I have to use pandas package .. Will it be easy to use pandas in that case?