How to execute a hyperlink?
Cameron Laird
claird at lairds.us
Wed Jan 28 10:17:26 EST 2009
In article <8UVfl.45$n_6.33 at newsfe22.ams2>,
Roel Schroeven <rschroev_nospam_ml at fastmail.fm> wrote:
>Muddy Coder schreef:
>> Hi Folks,
>>
>> Module os provides a means of running shell commands, such as:
>>
>> import os
>> os.system('dir .')
>>
>> will execute command dir
>>
>> I think a hyperlink should also be executed. I tried:
>>
>> os.system('http://somedomain.com/foo.cgi?name=foo&passwd=bar')
>>
>> but I got kicked out by the Python interpreter. I wonder somebody
>> knows the syntax of triggering a hyperlink? Thanks in advance!
>
>As others have said, you can use the webbrowser module for hyperlinks.
>Alternatively you can use os.startfile() which works hyperlinks and many
>types of files, but only works on Windows (it does the same as
>double-clicking in Windows Explorer).
.
.
.
I suspect that os.startfile() will indeed give Muddy Coder
the most immediate satisfaction. It might interest him,
though, also to experiment with
os.system("start %s" % URL)
Again, recognize this only gives happy results, in general,
under Win*.
More information about the Python-list
mailing list