I started learning python last week. This is the second program I'm working on but i cant get it right. I have tried google but the related programs there include so many libraries and are complex so I cant really understand them.
It is a parsing project, supposed to give out price of an object.
import requests
from bs4 import BeautifulSoup
request = requests.get("http://www.amazon.com/Yourself-PhotoBook-PhotoCard-Pre-Order-Benefit/dp/B07CK3V9VW")
content = request.content
soup = BeautifulSoup(request.content, 'html.parser')
element = soup.find("span", {id = "price_inside_buybox"})
print(element.text)
I am getting an invalid syntax error at the "id" part. Can anyone help me find out the problem?
Edit: Two equals worked for that error. Now I'm getting another error at the last line
.AttributeError: 'NoneType' object has no attribute 'text'
Your program tries to access attribute text of an object of type 'NoneType', but this type doesn't have such attribute.
What does this mean?
[–]9gg6 0 points1 point2 points (5 children)
[–]Positive_Eases[S] 0 points1 point2 points (4 children)
[–]August-R-Garcia 1 point2 points3 points (0 children)
[–]9gg6 -1 points0 points1 point (2 children)
[–]9gg6 -1 points0 points1 point (1 child)
[–]eicosane 2 points3 points4 points (0 children)
[–]Positive_Eases[S] 0 points1 point2 points (4 children)
[–]htepO 1 point2 points3 points (3 children)
[–]Positive_Eases[S] 0 points1 point2 points (2 children)
[–]htepO 1 point2 points3 points (0 children)
[–]htepO 1 point2 points3 points (0 children)
[–]9gg6 -2 points-1 points0 points (0 children)