Python 3.2 Unable to import urllib2 (ImportError: No module named urllib2)
Question: I am using Windows, and I get the error:

    
    
    ImportError: No module named urllib2
    

I think [this](http://stackoverflow.com/questions/2532321/python-importerror-
no-module-named-urllib) is the solution for Linux. But how to set this in
Windows?

I am using Python 3.2 and I am not able see `urllib2` there in the LiB folder.


Answer: In python 3 urllib2 was merged into urllib. _See also[another Stack Overflow
question](http://stackoverflow.com/questions/2792650/python3-error-import-
error-no-module-name-urllib) and the [urllib PEP
3108](http://www.python.org/dev/peps/pep-3108/#urllib-package)._

To make Python 2 code work in Python 3:

    
    
    try:
        import urllib.request as urllib2
    except ImportError:
        import urllib2
    

