Created
August 25, 2017 07:01
-
-
Save noveoko/1494642963da3682be66951e883bc61a to your computer and use it in GitHub Desktop.
This file contains 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
import requests | |
from bs4 import BeautifulSoup as bs | |
with open('file.txt', 'w') as f: | |
r = requests.get('http://cnn.com') | |
soup = bs(r.content, 'lxml') | |
headings = soup.find_all('a') | |
for h in headings: | |
f.write("{}\n".format(h)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment