Reputation: 2847
import urllib2
I can't import urllib2. I received this error:
Unresolved import: urllib2
They said that I should have a new python interpreter in the preference. But I've already done that. Please give me some clue about this.
Upvotes: 0
Views: 3562
Reputation: 239433
In python3, you have to use urllib3
. Documentation http://urllib3.readthedocs.org/en/latest/
import urllib3
http = urllib3.PoolManager()
response = http.request('GET', 'http://www.google.com')
print (response.data)
And there is no raw_input
in python3. You have to use input
function in python 3. Python 2's input
is equivalent to eval(input())
in python 3
Upvotes: 3
Reputation: 177396
Python 3.x is not compatible with Python 2.x. Your Internet example is for 2.x, and 3.x does not have an urllib2
module.
Upvotes: 1