Я упомянул код ниже; Я запускаю этот код, используя python 3.7
idle, который успешно выполняется, но когда я сохраняю его как file.py
и запускаю его с помощью cmd, он выдает import module
error.
Мой код:
import requests
from lxml import html
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.3'}
# url to scrape data from
link = 'https://www.bhaskar.com/sports/'
# path to particular element
path = '//*[@id="top-nav1"]'
response = requests.get(link,headers)
byte_string = response.content
# get filtered source code
source_code = html.fromstring(byte_string)
print(source_code)
# jump to preferred html element
tree = source_code.xpath(path)
print(tree.text_content())
Ошибка: невозможно импортировать имя 'html' из 'l xml'
Я не могу понять, когда оба работают на одинаковых python файлах, почему такая ошибка появляется! !! 
