How to execute a hyperlink?
Roel Schroeven
rschroev_nospam_ml at fastmail.fm
Wed Jan 28 04:51:00 EST 2009
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).
--
The saddest aspect of life right now is that science gathers knowledge
faster than society gathers wisdom.
-- Isaac Asimov
Roel Schroeven
More information about the Python-list
mailing list