"pierre dagenais" <eq...@ncf.ca> wrote

    sock = urllib.urlopen("http://diveintopython.org/";)
AttributeError: 'module' object has no attribute 'urlopen'

What is the proper syntax in version 3?

using help() shows that urllib has become a package in v3.
The request module looked promising and sure enough

import urllib.request as req
help(req)

shows:

   urlopen(url, data=None, timeout=<object object>)
urlretrieve(url, filename=None, reporthook=None, data=None)

HTH,


--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/



_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to