Skip to content

Instantly share code, notes, and snippets.

@jamescalam
Created May 4, 2020 10:29
Show Gist options
  • Select an option

  • Save jamescalam/8799f4a2aee281bac7e0aa12cbcf8ba9 to your computer and use it in GitHub Desktop.

Select an option

Save jamescalam/8799f4a2aee281bac7e0aa12cbcf8ba9 to your computer and use it in GitHub Desktop.
Importing beautiful soup library and extracting the list of letter links for Epistulae Morales Ad Lucilium.
import requests
from bs4 import BeautifulSoup
# import page containing links to all of Seneca's letters
# get web address
src = "https://en.wikisource.org/wiki/Moral_letters_to_Lucilius"
html = requests.get(src).text # pull html as text
soup = BeautifulSoup(html, "html.parser") # parse into BeautifulSoup object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment