google.py Originally from http://sourceforge.net/snippet/detail.php?type=snippet&id=100095. Run it with 'google.py search terms here'. import urllib, string, sys uopen=urllib.URLopener().open def lookup(words): try: t=uopen('http://www.google.com/search?'+ urllib.urlencode({'btnI' : "I'm feeling lucky", 'q' : words})) except IOError, detail: print detail[3].get('location') else: print "Something went wrong" if __name__ == "__main__": lookup(sys.argv[1:])