Regarding the First challenge of scrape a shopping website

Actually I got 84%, But maybe i am getting wrong where there is name of the book having commas. What to place where there are commas in the title of the book.

hey @mayanksingh4597 ,
When there are commas in any book title just enclose that title inside quotes. It will work for you.
Or you can directly use pandas module to work on this challenge as it by default handles the strings in that way.

I hope this helped you :slightly_smiling_face:.

import bs4 from urllib.request import urlopen from bs4 import BeautifulSoup as soup filename=“project_cb_1.csv” with open(filename,‘w’,encoding=‘utf-8’) as f: str3=“image_url,book_title,product_price”+"\n" f.write(str3) url1=“http://books.toscrape.com/catalogue/page-1.html” z=1 for j in range(50) : url=url1[:-6]+’{}’.format(z+j)+url1[-5:] data=urlopen(url) html=data.read() s2=soup(html,‘html.parser’) book_price=s2.findAll(‘p’,{‘class’:‘price_color’}) book_photo=s2.findAll(‘img’,{‘class’:‘thumbnail’}) book_name=s2.findAll(‘h3’) for i in range(20) : temp=book_name[i].find(‘a’) temp1=temp.get(‘title’) temp2=temp1.replace(’,’,"") str=book_photo[i].get(‘src’)+’,’+temp2+’,’+book_price[i].text str+="\n" f.write(str)

please look at my code i replace every ‘,’ in the book_title with “” but is giving only 84%

hey @mayanksingh4597,
i am not able your understand code like this.
Do one thing , upload your code , current submitted csv file on drive and share me its link.
It would be easier and more effective for me to understand your approach from there.

Thank You and Happy Learning :slightly_smiling_face:.

In that chat with TA option i had uploaded the code it is looking good there please have a look there

https://drive.google.com/file/d/19hQPnYbKY0wKKw91nLfKzSWQ9JdcOfEB/view?usp=sharing

here is the link of my csv file

hey @mayanksingh4597 ,
i have requested access to the above link.
Kindly allow it.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.