import urllib2
response=urllib2.urlopen("http://yts.ag")
print response.info()
response.close()
The above program shows the following error in python 2.7.
Traceback (most recent call last):
File "url_test.py", line 1, in <module>
import urllib2
File "C:\Python27\lib\urllib2.py", line 111, in <module>
from urllib import (unwrap, unquote, splittype, splithost, quote,
File "D:\Python\Python Test codes\urllib.py", line 4, in <module>
"Names and Addresses, URIs, URLs, URNs, URCs", at
AttributeError: 'module' object has no attribute 'urlopen'
I tried replacing the library file but did not help.