search for a data in my browser via script

Michael Torrie torriem at gmail.com
Mon Feb 6 10:55:02 EST 2017


On 02/06/2017 07:43 AM, Meeran Rizvi wrote:
> Hello guys,
> Here i am writing a script which will open my chrome browser and opens the URL www.google.com.
> But how to search for a data via script.
> for example i need to search for 'Rose' in google.com via script.
> how to do that?
> 
> <python>
> import webbrowser
> url="www.google.com"
> chrome_path = 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe %s'
> webbrowser.get(chrome_path)
> webbrowser.open(url)
> </python>

For most things, you can use the "urllib" module in the standard library.

https://docs.python.org/3/howto/urllib2.html

urllib will let you post to a url, which you'll have to do to get a
result from a search engine back.



More information about the Python-list mailing list