#!/usr/bin/env python """ Put this on your command line and scrape^wget Dow Jones Industrial Average. ed@hammer:~$ dow 10,671.87 (0%) """ import urllib import re html = urllib.urlopen("http://finance.google.com/finance?cid=983582").read() m = re.search(r'(.+)', html) i = m.group(1) m = re.search(r'\((.+)\)', html) if m: p = m.group(1) else: p = "0%" print "%s (%s)" % (i, p)