0
Whats the best way to improve this web scraper?
Hello all, I am a beginner Python developer, started not long ago. I was trying out web scraping with the BeautifulSoup library. The script I wrote at https://code.sololearn.com/cDP5W1cOFnTL/#py is meant to get the latest news items from a school website. Please let me know what you think and how it can/should be done better. Thanks in advance!
2 Réponses
+ 2
Line 6 is redundant, as well as line 8. You don't create a list without assigning a name to it. Also, you didn't even use lines 6-8 elsewhere in your code, then why bother to put them there? For line 9, why the pair of brackets?
https://code.sololearn.com/cAX9m7rt5ocX/#py
Do your selection by `soup.select(css_selector)`. Don't use `list()` indiscriminately.
0
Thanks Gloria Borger for your feedback