From 255d27a01a746604b15f91a57ce30adc4f7fe3d2 Mon Sep 17 00:00:00 2001 From: Gabriel-H189 Date: Sun, 26 Apr 2026 16:55:34 +0100 Subject: [PATCH] Use find_all instead of findAll --- .gitignore | 3 +++ basic_scrape.py | 4 ++-- basic_scrape_csv_export.py | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fdeb10c --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.mypy_cache +.venv +.vscode \ No newline at end of file diff --git a/basic_scrape.py b/basic_scrape.py index 6a4afcd..f847122 100644 --- a/basic_scrape.py +++ b/basic_scrape.py @@ -10,11 +10,11 @@ #FIND ALL THE ITEMS IN THE PAGE WITH A CLASS ATTRIBUTE OF 'TEXT' #AND STORE THE LIST AS A VARIABLE -quotes = soup.findAll('span', attrs={'class':'text'}) +quotes = soup.find_all('span', attrs={'class': 'text'}) #FIND ALL THE ITEMS IN THE PAGE WITH A CLASS ATTRIBUTE OF 'AUTHOR' #AND STORE THE LIST AS A VARIABLE -authors = soup.findAll('small', attrs={"class":"author"}) +authors = soup.find_all('small', attrs={"class": "author"}) #LOOP THROUGH BOTH LISTS USING THE 'ZIP' FUNCTION #AND PRINT AND FORMAT THE RESULTS diff --git a/basic_scrape_csv_export.py b/basic_scrape_csv_export.py index d036f15..d133410 100644 --- a/basic_scrape_csv_export.py +++ b/basic_scrape_csv_export.py @@ -19,11 +19,11 @@ soup = BeautifulSoup(page_to_scrape.text, 'html.parser') #FIND ALL THE ITEMS IN THE PAGE WITH A CLASS ATTRIBUTE OF 'TEXT' #AND STORE THE LIST AS A VARIABLE -quotes = soup.findAll('span', attrs={'class':'text'}) +quotes = soup.find_all('span', attrs={'class':'text'}) #FIND ALL THE ITEMS IN THE PAGE WITH A CLASS ATTRIBUTE OF 'AUTHOR' #AND STORE THE LIST AS A VARIABLE -authors = soup.findAll('small', attrs={"class":"author"}) +authors = soup.find_all('small', attrs={"class":"author"}) #LOOP THROUGH BOTH LISTS USING THE 'ZIP' FUNCTION #AND PRINT AND FORMAT THE RESULTS