Forked from fmasanori/100 melhores livros segundo Le Monde.py
Created
July 5, 2017 19:17
-
-
Save edueo/88798844cd71fe64e20ee9bf5b129a6f to your computer and use it in GitHub Desktop.
100 melhores livros segundo o Le Monde
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Laura Maia e Letícia Barreto | |
import requests | |
from bs4 import BeautifulSoup | |
url='https://pt.wikipedia.org/wiki/Os_100_livros_do_s%C3%A9culo_segundo_Le_Monde' | |
soup = BeautifulSoup(requests.get(url).text, 'html.parser') | |
nome=[nome.string.strip() | |
for nome in soup.findAll('i')] | |
ranking=[rank.string | |
for rank in soup.findAll('td', {'align':"right"})] | |
livros = [{'Ranking': x, 'Nome': y} | |
for x , y in zip(ranking, nome)] | |
for livro in livros: | |
print ('{} {}'.format(livro['Ranking'], livro['Nome'])) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment