как убрать закодированные символы - PullRequest
0 голосов
/ 07 марта 2020

Ошибка:

Traceback (most recent call last):
   File "C:\Users\gavin\AppData\Local\Temp\atom_script_tempfiles\2c36e7c0-6099-11ea-9ee3-eff5d5088bc9", line 35, in <module>
     print(title + ' ' + color + price + ' ' + price)
   File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.752.0_x64__

вот мой код

import bs4
import requests
import csv
url = requests.get('https://www.flipkart.com/search?q=lego&otracker=search&otracker1=search&marketplace=FLIPKART&as-show=on&as=off')
soup = bs4.BeautifulSoup(url.text, 'html.parser')
containers = soup.select('._3liAhj')
for container in containers:
    titles = container.select('._2cLu-l')
    title = titles[0].text.strip()

    colors = container.select('._1rcHFq')
    color = colors[0].text.strip()

    prices = container.select('._1vC4OE')
    price = prices[0].text

print(title + ' ' + color + price + ' ' + price)
...