Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fmasanori/603b1b3dc5717806f32f54d1b4eefe34 to your computer and use it in GitHub Desktop.
Save fmasanori/603b1b3dc5717806f32f54d1b4eefe34 to your computer and use it in GitHub Desktop.
100 melhores livros segundo o Le Monde
#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']))
@guimaraf
Copy link

guimaraf commented Jul 5, 2017

Excelente código

@ramiroluz
Copy link

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment