There was a syntax error in Python scraping.I don't know how to fix it.

Asked 2 years ago, Updated 2 years ago, 110 views

"I wanted to pull the sentence ""Day of Olaf's Birth"" in the first image, so I wrote it like the second image, but I got an error because there was a hyphen in the attribute name."When I try to erase this hyphenated attribute, it says Nonetype object has no attribute 'find' and I don't know how to fix it.

Actual Screen:

This is the actual screen

Python display:

python screen

python python3 web-scraping

2022-09-30 16:35

1 Answers

SyntaxError lines are resolved by enclosing 'single quotation' where you want to enter class_.

 title=movedetail.find(
'span', class_='"h2ng-binding", ng-binding="$ctrl.product.Name"")

I recommend you to look into regular expressions.
However, the same error occurs even if you run it as it is.This modal-content appears after you click "See More", so there will be None in the movedetail.
BeautifulSoup is a static parsing library, so it is recommended that you use selenium sendkey for dynamic pages as mentioned above.

This may be helpful:
How to send key with BeautifulSoup


2022-09-30 16:35

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.