Python Forum

Full Version: can't assign to operator
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am trying to scrap this jokes from the website but i get the assignment operator error

from urllib.requests import urlopen as uReq
from bs4 import BeautifulSoup as soup 

quotes_page = ''

uClient = uReq(quotes_page)
page_html =

page_soup = soup(page_html, "html.parser")
quotes = page_soup.findAll("div",{"class":"jokes"})

for quote in quotes:
	fav_quote = quote.findAll("div",{"class":"joke-msg"})
	joke-msg = fav_quote[0].text.stip()

	fav_authors = quote.findAll("div",{"class":"joke-text"})
	joke-text = fav_authors[0].text.strip()

	print (joke-msg)
	print (joke-text)
Error messsage
  File "", line 17
    joke-msg = fav_quote[0].text.stip()
SyntaxError: can't assign to operator
please, post the full traceback you get in error tgs
Variables can't have a dash in them. You can use underscores instead though.