Clickable hyperlinks

Michael Torrie torriem at gmail.com
Wed Jan 4 19:47:39 EST 2017


On 01/04/2017 03:58 PM, Deborah Swanson wrote:
> Thank you, thank you! Finally, at least one person on this list knows
> about something (anything) in the python world that is internet aware.
> It's also occurred to me that Beautifulsoup downloads data from a url,
> so that code must have access to some kind of an internet engine too.

Except that you never mentioned anything about this in your posts
before. It seemed to me you were asking about printing out clickable
hyperlinks with python.  Calling the OS to launch a browser to view a
url is a different beast which is why no one mentioned it before.

If you don't tell us what you're actually trying to do (your end goal),
things are more frustrating for everyone.  If you had said early on you
just want to be able to send the user to a particular url in a web
browser, what Chris suggested would have been said a long time ago,
rather than focusing on console output which is what you were asking
about and focusing attention on.

Just so you know, BeautifulSoup does not do any internet access itself;
it's only an HTML parser. You have to fetch web pages using something
like python's urllib and then feed the data to BeautifulSoup.  urllib is
not a web browser though.  It can pretend to be a browser as far as the
server is concerned but it knows nothing about javascript or rendering.
It just retrieves bytes which you can then feed to BeautifulSoup or some
other parser.

> Yes, I'd gotten as far as figuring out that you don't need a clickable
> link. Code that opens a url in a browse would do the job just fine. 

Good! I just wish you would have mentioned this much earlier as your end
goal.

> Or the webbrowser.open("http://......./") in a Linux terminal you suggest.
> (I just have to get my Linux machine up and running again to try it.)

The webbrowser module does not require console or terminal output. It
will work on Windows or Linux if I'm not mistaken.  It asks the OS to
launch the default browser and load the indicated url.

> All in all, given that clickable urls in a console is a non-starter,
> this hits the nail on the head. Many thanks again!





More information about the Python-list mailing list