Skip to content

Instantly share code, notes, and snippets.

Created December 6, 2012 11:05
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Search where people are moving in Germany
# coding: utf-8
# requires: pattern
from pattern.web import *
import csv
import sys
# yeah I know
# engine = Google(license='XXX', throttle=2.0)
#engine = Twitter(license=None)
engine = Bing()
phrase = '"von %s nach %s gezogen"'
cities = ["Berlin", "Hamburg", "München", "Köln", "Frankfurt am Main", "Stuttgart", "Düsseldorf", "Dortmund", "Essen", "Bremen", "Leipzig", "Dresden", "Hannover", "Nürnberg", "Duisburg", "Bochum", "Wuppertal", "Bonn", "Bielefeld", "Mannheim", "Karlsruhe", "Münster", "Wiesbaden", "Augsburg", "Aachen", "Mönchengladbach", "Gelsenkirchen", "Braunschweig", "Chemnitz", "Kiel"]
csv_writer = csv.writer(open("cities.csv", 'wb'), delimiter="\t", quoting=csv.QUOTE_NONNUMERIC)
csv_writer.writerow(["Source", "Target", "Weight"])
for i in cities:
for j in cities:
results = % (i,j), type=SEARCH)
csv_writer.writerow([i, j,])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment