C:\Windows\System32>pip list
pip (8.1.2)
setuptools (25.2.0)
C:\Users\UsovON\PycharmProjects\villu\venv\Scripts\python.exe C:/Users/UsovON/PycharmProjects/villu/321.py
Traceback (most recent call last):
File "C:/Users/UsovON/PycharmProjects/villu/321.py", line 1, in <module>
import requests
File "C:\Users\UsovON\PycharmProjects\villu\venv\lib\site-packages\requests\__init__.py", line 134, in <module>
from . import packages
File "C:\Users\UsovON\PycharmProjects\villu\venv\lib\site-packages\requests\packages.py", line 15, in <module>
locals()[package] = __import__(package)
File "C:\Users\UsovON\PycharmProjects\villu\venv\lib\site-packages\idna\__init__.py", line 1, in <module>
from .core import (
File "C:\Users\UsovON\PycharmProjects\villu\venv\lib\site-packages\idna\core.py", line 93
number_type: Optional[str] = None
^
SyntaxError: invalid syntax
Почему ругается на ошибку в файле core.py?
pip (8.1.2)
setuptools (25.2.0)
Код:
from LxmlSoup import LxmlSoup
import requests
html = requests.get('https://sunlight.net/catalog').text # получаем html код сайта
soup = LxmlSoup(html) # создаём экземпляр класса LxmlSoup
links = soup.find_all('a', class_='cl-item-link js-cl-item-link js-cl-item-root-link') # получаем список ссылок и наименований
for i, link in enumerate(links):
url = link.get("href") # получаем ссылку товара
name = link.text() # извлекаем наименование из блока со ссылкой
price = soup.find_all("div", class_="cl-item-info-price-discount")[i].text() # извлекаем цену
print(i)
print(f"Url - {url}")
print(f"Name - {name}")
print(f"Price - {price}\n")
C:\Users\UsovON\PycharmProjects\villu\venv\Scripts\python.exe C:/Users/UsovON/PycharmProjects/villu/321.py
Traceback (most recent call last):
File "C:/Users/UsovON/PycharmProjects/villu/321.py", line 1, in <module>
import requests
File "C:\Users\UsovON\PycharmProjects\villu\venv\lib\site-packages\requests\__init__.py", line 134, in <module>
from . import packages
File "C:\Users\UsovON\PycharmProjects\villu\venv\lib\site-packages\requests\packages.py", line 15, in <module>
locals()[package] = __import__(package)
File "C:\Users\UsovON\PycharmProjects\villu\venv\lib\site-packages\idna\__init__.py", line 1, in <module>
from .core import (
File "C:\Users\UsovON\PycharmProjects\villu\venv\lib\site-packages\idna\core.py", line 93
number_type: Optional[str] = None
^
SyntaxError: invalid syntax
Почему ругается на ошибку в файле core.py?