mercredi 30 décembre 2015

urllib.request error!! no host given

Hi, I am quite new to Python and am currently learning it.So i have this small code

import urllib.request

x = urllib.request.urlopen('https:\\www.google.com')

print(x.read())

when i run it Python shouts out this error

Traceback (most recent call last):
File "C:/Users/The Kids/Desktop/urllib.py", line 3, in <module>
x = urllib.request.urlopen('https:\\www.google.com')
File "C:\Program Files\Python35-32\lib\urllib\request.py", line 162, in                    
urlopen
return opener.open(url, data, timeout)
File "C:\Program Files\Python35-32\lib\urllib\request.py", line 463, in open
req = meth(req)
File "C:\Program Files\Python35-32\lib\urllib\request.py", line 1163, in             
do_request_
raise URLError('no host given')
urllib.error.URLError: <urlopen error no host given>

Could i please get help at this.

Regards

Yousuf




Aucun commentaire:

Enregistrer un commentaire