Created
April 18, 2013 04:42
-
-
Save danilobellini/5410178 to your computer and use it in GitHub Desktop.
Creates a list with the name of all programming languages there are (based on Wikipedia)
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# Danilo de Jesus da Silva Bellini | |
# Created on Thu Apr 18 2013 | |
""" | |
Prints all programming languages (from Wikipedia) | |
""" | |
from bs4 import BeautifulSoup # Needs "pip install beautifulsoup4" | |
from urllib2 import Request, build_opener | |
url = "http://en.wikipedia.org/wiki/List_of_programming_languages" | |
ff_string = "Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 Firefox/2.0.0.11" | |
req = Request(url, headers={"User-Agent": ff_string}) | |
data = build_opener().open(req).read() | |
for link in BeautifulSoup(data).select(".multicol a"): | |
print link.text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment