[Tutor] Re: Tutor Digest, Vol 12, Issue 71
Kent Johnson
kent37 at tds.net
Mon Feb 14 12:15:17 CET 2005
Lobster wrote:
> That is a good tip and seems to be the place I need to look
> - not really quite sure what I am looking at in the help docs
> I also have the complication of having to use is it "C:\\"
> - two back slashes?
>
> I am trying to get a wikipedia directed search that will load firefox and
> search for an inputted word . . .
You might look at the webbrowser module, it makes it easy to load the default browser. If you always
want firefox I don't know if it will work though:
>>> import webbrowser
>>> url = "http://en.wikipedia.org/wiki/" + 'Python'
>>> webbrowser.open(url)
> Anyway this is the code (only my second useful program)
> eh - not working so far . . .
>
> usually dumbing down help appreciated
>
> =====
>
> Ed Jason
>
> ========= <code>
>
> # Wikipedia search engine
> # Sunday Feb 12
>
> import os
> word_sought = raw_input("What is your wikipedia search word? ")
> goto_url_location = "http://en.wikipedia.org/wiki/" + word_sought
> print goto_url_location
> os.execv('C:\Program Files\Mozilla Firefox\firefox.exe') +
> goto_url_location
Not sure but I think this should be
os.execl(r'C:\Program Files\Mozilla Firefox\firefox.exe', goto_url_location)
Note the use of raw string so \ means what you want, and goto_url_location is inside the parens.
Kent
>
> ======== </code>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
More information about the Tutor
mailing list