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 "mysite.com/coolpage.html", 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 like: >> url = url_class("mysite.com/coolpage.html") >> print(url) "http://mysite.com/coolpage.html") >> print(url.plain) "mysite.com/coolpage.html" >> print(url.html('My Site")) '<a href="http://mysite.com/coolpage.html">My Site</a>' (or whatever... I think I actually just sub-classed url.parse or something) -----Original Message----- From: Python-list [mailto:python-list-bounces+d.strohl=f5....@python.org] On Behalf Of Devin Jeanpierre Sent: Tuesday, January 03, 2017 12:57 PM To: pyt...@deborahswanson.net Cc: comp.lang.python <python-list@python.org> 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 <pyt...@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 > -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list