Guest User

Parser

a guest
Oct 20th, 2019
126
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import requests
  2. from bs4 import BeautifulSoup
  3. url = 'https://minfin.com.ua/currency/nbu/'
  4. money = []
  5.  
  6.  
  7. source = requests.get(url)
  8. main_text = source.text
  9. soup = BeautifulSoup(main_text)
  10.  
  11. table = soup.find('table', {'class' : 'table-auto'})
  12. tr = table.findAll('td', {'class' : 'responsive-hide'})
  13. money.extend(tr)
  14. for f in money[:3]:
  15.     f = f.text
  16.     vibor = input("Выберите валюту: doll, euro, rub ")    
  17.     if vibor == "doll":
  18.         print("Курс доллара " + f[:7])
  19.         break
  20.     elif vibor == "euro":
  21.         print(f)
RAW Paste Data