Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from urllib.request import urlopen
- from bs4 import BeautifulSoup
- html = urlopen("http://www.portaltransparencia.gov.br/copa2014/api/rest/empreendimento")
- bsObj = BeautifulSoup(html.read(), 'xml')
- lista = bsObj.findAll("valorTotalPrevisto")
- soma = 0
- for v in lista:
- print(v.get_text())
- soma = soma + float(v.get_text())
- print ('Total:', soma)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement