Google Search

By Kaspersky_ on Jul 31, 2008

Script that starts a google search with specified criteria.

import urllib

class main(object):
    def addExtension(self):
        search_criteria = raw_input("Insert Google search here: ")
        print \
        print "Searching..."
        webPage = urllib.FancyURLopener({})
        readWeb = webPage.open("http://www.google.com/search?hl=en&q="+search_criteria+"&btnG=Search")

    def runIt(self):
        self.addExtension()

M = main()
M.runIt()

Comments

Sign in to comment.
cptpan   -  Jul 08, 2012

Sweet, I made the results less ugly and it works fine.

 Respond  
PATX   -  Jun 09, 2010

@AnaBotNowYourGone I'm pretty sure it would call it about the same... Unless we go into milisecond crap, which is uneeded for a simple (maybe pointless? IDK) script like this.

 Respond  
AnaBotNowYourGone   -  Jun 08, 2010

I like this. :) But the one PATX said is shorter. But I don't know if I would call it faster.

 Respond  
PATX   -  May 28, 2009

I have a better shorter and faster version...

import webbrowser

google = raw_input('Google search:')
webbrowser.open_new_tab('http://www.google.com/search?btnG=1&q=%s' % google)
 Respond  
PATX   -  Apr 26, 2009

good code... bit sloppy but not too bad. bit pointless but it is a good demenstartion of urllib. gets a 5.

 Respond  
armagidon   -  Dec 14, 2008

not work

 Respond  
vaseline28   -  Sep 29, 2008

Nice work :)
Particularly helpful for someone learning Python like me.

 Respond  
bps19882006   -  Aug 18, 2008

nice...nice...

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.