K
K
kolyadrozd2021-07-03 10:15:55
Python
kolyadrozd, 2021-07-03 10:15:55

I am making code for parsing sites and it gives me an error name 'html' is not defined how can I fix it?

from bs4.builder import HTML
import requests 
import lxml
from bs4 import BeautifulSoup
from random import choice 
responce = requests.get('https://www.rambler.ru/').content
HTML = BeautifulSoup(responce,'lxml')

fact = choice(html.find_all('h3', class_ = '_3ZkM'))

print(fact)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2021-07-03
@kolyadrozd

In Python variable names are case sensitive, HTML and html are two different variables.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question