2010-03-11 23:53:45 +01:00
|
|
|
#! /usr/bin/env python3
|
2001-12-04 16:23:47 +01:00
|
|
|
|
|
|
|
import sys, webbrowser
|
|
|
|
|
|
|
|
def main():
|
|
|
|
args = sys.argv[1:]
|
|
|
|
if not args:
|
2007-08-03 19:06:41 +02:00
|
|
|
print("Usage: %s querystring" % sys.argv[0])
|
2001-12-04 16:23:47 +01:00
|
|
|
return
|
|
|
|
list = []
|
|
|
|
for arg in args:
|
|
|
|
if '+' in arg:
|
|
|
|
arg = arg.replace('+', '%2B')
|
|
|
|
if ' ' in arg:
|
|
|
|
arg = '"%s"' % arg
|
|
|
|
arg = arg.replace(' ', '+')
|
|
|
|
list.append(arg)
|
|
|
|
s = '+'.join(list)
|
2002-02-08 17:20:07 +01:00
|
|
|
url = "http://www.google.com/search?q=%s" % s
|
2001-12-04 16:23:47 +01:00
|
|
|
webbrowser.open(url)
|
|
|
|
|
2004-08-09 19:27:55 +02:00
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|