I am just trying to fetch data from a live web by using the urllib module, so I wrote a simple example
Here is my code:
import urllib
sock = urllib.request.urlopen("http://diveintopython.org/")
htmlSource = sock.read()
sock.close()
print (htmlSource)
But I got error like:
Traceback (most recent call last):
File "D:\test.py", line 3, in <module>
sock = urllib.request.urlopen("http://diveintopython.org/")
AttributeError: 'module' object has no attribute 'request'