Clickable hyperlinks

Deborah Swanson python at deborahswanson.net
Mon Jan 2 20:34:48 EST 2017


Devin Jeanpierre wrote, on January 03, 2017 12:57 PM

>Sadly, no. :(  Consoles (and stdout) are just text, not hypertext. The
way to
>make an URL clickable is to use a terminal that makes URLs clickable,
and
>print the URL:
>
>
>print("%s: %s" % (description, url))
>
>
>
>
>-- Devin

I'm sorry, I should have said a GUI console because I wouldn't expect a 
text-based console to produce clickable links. But it appears that a simple GUI 
console can't do it either. I have 3 GUI consoles and in all 3, when I ask:

print("%s: %s" % ("python.org list", 
"https://mail.python.org/mailman/listinfo/python-list"))

I get:
python.org list: https://mail.python.org/mailman/listinfo/python-list

(Outlook made the url clickable here, the python GUI consoles just output plain 
text.)

Pretty clearly the output is plain text because your format parameters are %s. 
Maybe the trick, if there is one, is in a format parameter for urls.



On Tue, Jan 3, 2017 at 11:46 AM, Deborah Swanson
<python at deborahswanson.net> wrote:

Excel has a formula:

=HYPERLINK(url,description)

that will put a clickable link into a cell.

Does python have an equivalent function? Probably the most common use for it 
would be output to the console, similar to a print statement, but clickable.

--
https://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list