Created
July 5, 2017 13:12
-
-
Save fmasanori/603b1b3dc5717806f32f54d1b4eefe34 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
Excelente código