Clickable hyperlinks

Deborah Swanson python at deborahswanson.net
Wed Jan 4 04:32:12 EST 2017


Steven D'Aprano wrote, on January 03, 2017 9:40 PM
> 
> On Wednesday 04 January 2017 15:46, Deborah Swanson wrote:
> 
> > Steven D'Aprano wrote, on January 03, 2017 8:04 PM
> [...]
> >> Of course you have to put quotes around them to enter them in your 
> >> source code. We don't expect this to work:
> >> 
> >>     print(Hello World!)
> >> 
> >> 
> >> you have to use a string literal with quotes:
> >> 
> >>     print('Hello World!')
> >> 
> >> 
> >> Same for all of the above.
> 
> > I didn't try printing them before, but I just did. Got:
> > 
> >>>> print([Example](http://www.example.com)
> >       
> > SyntaxError: invalid syntax  (arrow pointing at the colon)
> 
> You missed the part where I said you have to put them in quotes.
> 
> Like any other string in Python, you have to use quotation 
> marks around it for 
> Python to understand it as a string. None of these things will work:
> 
> print( Hello World! )
> 
> print( What do you want to do today? )
> 
> print( 3 2 1 blast off )
> 
> print( http://www.example.com )
> 
> 
> This isn't specific to print. This won't work either:
> 
> message = Hello World!
> 
> In *all* of these cases, you have to tell Python you're 
> dealing with a string, 
> and you do that with quotation marks:
> 
> message = "Hello World!"
> print( 'What do you want to do today?' )
> count_down = '3 2 1 blast off'
> url = 'http://www.example.com'
> 
> 
> 
> 
> -- 
> Steven

Thanks, Steven. Yes, of course if you want to print strings you must
enclose them in quotes. I think you learn that in Week 1 of any
introductory course on Python.

But we aren't trying to print strings here, the point is to produce
clickable links. I didn't enclose them with quotes because I didn't see
any point in printing plain text when I wanted clickable links. I
actually didn't understand why you thought I should print them, but it
never would have occurred to me that you wanted me to print out a bunch
of silly plain text strings, apparently just for the heck of it.

At this point, if I pursue this any farther, it will be to look into how
Firefox takes webpage titles and urls out of its sqlite database and
makes objects you can click on to open the webpages. That's the basic
technology I'd need to find a way to talk (write) python into doing. 

If it's even worth it. On a practical level it's not worth it, way too
much work for the teensy advantage of having it to use. It might be some
giggles to figure out how to do it and maybe I will sometime just for
funsies.

My original question was whether python had anything to provide this
functionality, and the answer appears to be a resounding NO!!!

Answer received, and thanks to all who contributed.



More information about the Python-list mailing list