Clickable hyperlinks

Tim Chase python.list at tim.thechases.com
Tue Jan 3 17:26:16 EST 2017


On 2017-01-03 11:46, Deborah Swanson 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.

Depends on what you're outputting.  In your context, you're creating
content (and metadata) for a cell in an Excel workbook.

If that's the case you might have to use something like the xlwt
module to create an Excel-style worksheet and adjust the properties
of the cell to include the hyperlink property.

Or you can write out a .csv file with a hyperlink in a cell, which I
believe Excel can interpret as a hyperlink.

Or write an HTML document with the corresponding HTML <a> tag in it.

Or you can just print it to stdout as normal as some terminals detect
them and auto-linkify them.

But you have to specify where you want this link to appear to know
how to solve the problem.

-tkc






More information about the Python-list mailing list