How to execute a hyperlink?

Jeff McNeil jeff at jmcneil.net
Wed Jan 28 10:18:00 EST 2009


On Jan 27, 7:59 pm, Muddy Coder <cosmo_gene... at yahoo.com> wrote:
> 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!
>
> Muddy Coder

Like others have said, if you want a browser window, use the
'webbrowser' module. If you're looking to simply trigger a GET/POST
without the UI aspect, then you'll probably want urllib or urllib2.

Thanks,

Jeff
mcjeff.blogspot.com



More information about the Python-list mailing list