user3371183
user3371183

Reputation: 63

Python urllib2 library

I copied an example whcich use this library but when i get to the line import urllib2 it gives me an error : No module named 'urllib2'. I searched for a download of the library but couldnt found. Anyone can help me? Thank you.

Upvotes: 2

Views: 237

Answers (2)

Conans
Conans

Reputation: 481

I guess you are using Python 3. In Python 3, urllib2 is renamed to urllib.

More info Python urllib

Upvotes: 1

utdemir
utdemir

Reputation: 27216

It's most probable that you are using Python 3.

With Python versions > 3, those relevant modules are structured like this:

Current Name      Replacement Name
urllib2           urllib.request, urllib.error
urlparse          urllib.parse
urllib            urllib.parse, urllib.request, urllib.error [6]
robotparser       urllib.robotparser

Upvotes: 3

Related Questions