Skip to content

Instantly share code, notes, and snippets.

@Sparrow1029
Created November 8, 2017 07:11
Show Gist options
  • Save Sparrow1029/598ffcfa1ef8e80e0223cc5ef445f3f7 to your computer and use it in GitHub Desktop.
Save Sparrow1029/598ffcfa1ef8e80e0223cc5ef445f3f7 to your computer and use it in GitHub Desktop.
Python Practice 19 - Decode a web page [Sparrow1029]
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup
from pprint import pprint
r = \
requests.get('http://www.vanityfair.com/society/2014/06/monica-lewinsky-humiliation-culture')
soup = BeautifulSoup(r.text, "lxml")
p_tags = soup.find_all("p")
for i in p_tags:
print(pprint(i.text))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment