Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python webbrowser open doesn't open url that has been stored in variable

Tags:

python

I just have a simple question. When I do something like

 import webbrowser

 webbrowser.open('www.google.com')

it works,and opens a page using my default browser However,when I store the url in a variable, it doesn't open it..doesn't throw up any errors or anything either.. something like:

 import webbrowser

 url=raw_input("Enter url")
 webbrowser.open(url)

Anyone have any ideas as to why this might be happening?

like image 312
Hassan Ali Avatar asked Apr 24 '26 08:04

Hassan Ali


1 Answers

The solution to this problem is to include http:// in the address, i.e., http://www.google.com.

like image 130
wrkyle Avatar answered Apr 25 '26 22:04

wrkyle