Clickable hyperlinks

Dan Strohl D.Strohl at
Tue Jan 3 04:34:56 EST 2017

The best bet (unless you know that you are outputting to a specific place, like 
html or excel) is to always include the "https://" or "http://" since most of 
the consoles / terminals that support clickable links are parsing them based on 
"seeing" the initial "http://".  If your output just looks like 
"", many systems will simply ignore them.

At one point I had made a class that you could pass the link to, and then you 
could request different output based on your needs... so basically something 

>> url = url_class("")
>> print(url)
>> print(url.plain)
>> print(url.html('My Site"))
'<a href="">My Site</a>'

(or whatever... I think I actually just sub-classed url.parse or something)

-----Original Message-----
From: Python-list [ at] On
Behalf Of Devin Jeanpierre
Sent: Tuesday, January 03, 2017 12:57 PM To: python at
Cc: comp.lang.python <python-list at>
Subject: Re: Clickable hyperlinks

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

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

> 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.
> --

More information about the Python-list mailing list