Skip to content

Instantly share code, notes, and snippets.

@danilobellini
Created April 18, 2013 04:42
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danilobellini/5410178 to your computer and use it in GitHub Desktop.
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)
#!/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