NameError: name 'soup' is not defined

I am following this tutorial: Pandas Tutorials : Web Scraping - YouTube

I am having trouble with this code:

Please assist.

“Unexpected indent” means exactly what it says. Remove the indent (leading spaces or tabs) from the beginning of the line.

Also, please don’t post photos or screenshots of code unless you use Photoshop to edit it :slight_smile:

In this case it doesn’t make much difference, but screenshots make it difficult for us to run your code if we have to, and discriminate against the blind and visually impaired (yes, blind programmers exist).

Instead, copy the relevant code and error message, and paste it into the Discuss text entry widget. Use the </> button to format it as code, by placing the copied code between “code fences”, three backticks on a line of their own before and after the code:

```
paste your code here
```
1 Like

“review_text_elem = soup.find_all(class_= ‘ellipsis_text’)
review_text_elem”
NameError: name ‘soup’ is not defined

Again, the message says it all: you haven’t defined soup. You have defined Data however, from the context it appears that you want to use that

I start with this:

 import request
import pandas as pd
from bs4 BeautifulSoup

#send request
url=‘Reviews of Credit Cards, Loans, Insurance |BankBazaar
page=requests.get(url)
page.text

url = 'https://www.bankbazaar.com/reviews.html'
page=requests.get(url)
Soup = BeautifulSoup(page.text, 'html.parser')
review_text_elem = soup.find_all(class_= 'ellipsis_text')
review_text_elem

soup is not Soup. Python is case-sensitive.

I am getting this output:

Asin this tutorial.

I am supposed to get a similar output like this:

Use the </> button to paste TEXT do not put picture of code in here please.

All of the code has already been supplied. I include pics for the outcome i get.

We’d like text for those also. The visually impaired have trouble with
pictures. We cannot copy/paste text from pictures, particularly if we
want to quote specific bits back at you for context. People on email do
not receive the pictures, and must tediously trudge to the forum to look
at them.

Thank you,
Cameron Simpson cs@cskk.id.au

Am I correct in noticing that the code where you say “I am getting this output” is different from the code where you say “I am supposed to get a similar output like this” ?

Hi Albert
If you can please try this tutorial(I shared the link)on your side and show me what you have come up with.