repo.or.cz
/
python
/
dscho.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
move sections
[python/dscho.git]
/
Tools
/
scripts
/
google.py
blob
b2ab1a43af2545bfac45ebcfeef5709fc16e5808
1
#! /usr/bin/env python
2
3
import
sys
,
webbrowser
4
5
def
main
():
6
args
=
sys
.
argv
[
1
:]
7
if not
args
:
8
print
"Usage:
%s
querystring"
%
sys
.
argv
[
0
]
9
return
10
list
= []
11
for
arg
in
args
:
12
if
'+'
in
arg
:
13
arg
=
arg
.
replace
(
'+'
,
'%2B'
)
14
if
' '
in
arg
:
15
arg
=
'"
%s
"'
%
arg
16
arg
=
arg
.
replace
(
' '
,
'+'
)
17
list
.
append
(
arg
)
18
s
=
'+'
.
join
(
list
)
19
url
=
"http://www.google.com/search?q=
%s
"
%
s
20
webbrowser
.
open
(
url
)
21
22
if
__name__
==
'__main__'
:
23
main
()