Home python How to spar three currency columns? (Error in the code Bestchezh site)

How to spar three currency columns? (Error in the code Bestchezh site)




Here I wanted to parse three columns of the desired currency, but an error with the third column arises. The problem is that you put the digit that parsit from one place when you put a variable, then the pair starts and the second column of the getter porridge. And how else can you wrap in Tinter Add ?

def bestchange ():
    CRIP = "https://www.bestchange.ru/ripple-to-yoomoney.html"
    Response = Requests.get (CRIP, Headers = Headers) .text
    Soup = Beautifulsoup (response.content, 'html.parse')
    Convert2 = Soup.findall ("Table", {"id": "Content_table"})
    Convert2 = Soup.Findall ("DIV", {"Class": "PC"}, {"" Class ":" CA "})
    Convert = Soup.Findall ("TD", {"Class": "Bi"})
    convert3 = Soup.findall ("TD", {"Class": "BI"}) # here in this movable everything and leuetz.
    Con = Soup.findall ("DIV", {"Class": "intro"})
    Print (CON [0] .text)
    For i in Range (20):
      Tro = convert2 [i] .text + "==" + convert [0] .text + "==" + Convert3 [3] .Text # here in this movable everything and a leomeset.
      PRINT (TRO)
  Bestchange ()

How to fix these two errors in the code?
1) Couldn’t Find A Tree Builder with the Features You Requested: HTML.PARSE. Do You Need To Install A Parser Library?
2) The Code That Caused This Warning Is On Line 22 of the File C: \ Users \ Parser_Valut_invest.py. To Get Rid Of this Warning, Pass The Additional Argument ‘Features = “LXML”‘ to the beautifulsoup constructor.

Soup = Beautifulsoup (Response, ‘HTML’)
3) List Index Out of Range
How to solve these mistakes !!
Here are these 3 columns trying there 2 classes identical!
And here https://prnt.sc/116pih0
Rugetz Paiton on this line
Soup = Beautifulsoup (response.content, ‘html.parse’)
I do this:
Soup = Beautifulsoup (Response, ‘HTML’)
It works but gives an error and the result is.
I write on Paichar and Sablay text 3.

Answer 1

You have a typo in the name of the parser, not html.parse , and html.parser

Poule tables immediately in cells are not worth it, it’s better on rows, and there already disassemble cells.

Caught Example :

import requests
From BS4 Import Beautifulsoup
RS = Requests.get ('https://www.bestchange.ru/ripple-to-yoomoney.html')
root = beautifulsoup (rs.content, 'html.parser')
for tr in root.select ('# content_table & gt; tbody & gt; tr'):
  name = tr.select_one ('td.bj .pc .ca'). Get_Text (Strip = True)
  [Give_EL, get_el] = tr.select ('TD.BI')
  Give = give_el.select_one ('. FS'). Get_Text (Strip = True)
  Get = Get_el.Get_Text (strip = true)
  Print (Name, Give, Get, SEP = '|')


chstic | 1 XRP | 67.3091RUB Yumoney
Btclider | 1 XRP | 67.0861RUB Yumoney
Cryptohome | 1 XRP | 67.0227RUB Yumoney
EX-BANK | 1 XRP | 49.3700RUB Yumoney
Crypto-Store | 1 XRP | 47.8860RUB Yumoney
Coinstart | 1 XRP | 44.2528RUB Yumoney

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions