Python Webbrowser - Open A Url Without Https://
I am trying to get python to open a website URL. This code works. import webbrowser url = 'http://www.example.com/' webbrowser.open(url) I have noticed that python will only open
Solution 1:
Why not just add it?
if not url.startswith('http')
if url.startswith('www'):
url = "http://" + url
else
url = "http://www." + url
Solution 2:
If you really don't want to change the url string (which is quite fast and easy) like stazima said, then you can use Python 3. It supports all the listed url types in your question (tested them).
Post a Comment for "Python Webbrowser - Open A Url Without Https://"