Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions python/gs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,21 @@

if(len(sys.argv)>1):

# sys.argv basically returns all the commandline arguments given while running the code
# sys.argv returns all the commandline arguments given while running the code
# in sys.argv the first argument is file path and the other are arguments given

word = ' '.join(sys.argv[1:])

#the above code basically inserts the word which you give as commandline argument as string in variable word
#the above code inserts the word which you give as commandline argument as string in variable word
else:

word = pyperclip.paste()

var x = input('Enter a number: ')
var y = input('Enter another number: ')
print(int(x) + int(y))

#the above line satisfies the desire to do math while the page loads
address = webbrowser.open('https://www.google.co.in/search?site=&source=hp&q=' + word)

#finally the above line opens the webbrowser and searches the word in google which is passed as command line argument