>> import pprint...">

Unable to import pprint

Newbie programming here. Whenever I try to "import pprint" into Python IDLE, I get the following error:

>>> import pprint Traceback (most recent call last): File "<pyshell#21>", line 1, in <module> import pprint File "C:\Python34\pprint.py", line 10, in <module> pprint(count) NameError: name 'pprint' is not defined 

Thought I'd try to “install install pprint” on the command line, but that didn't work either:

 PS C:\Python34> pip install pprint Collecting pprint Could not find a version that satisfies the requirement pprint (from versions: ) No matching distribution found for pprint 

I thought Python 3.4.3 should have come with the pprint module. How do I make it work? It does not seem to import pprint, but all other modules work fine. I need a pprint module to work on some of the Automate The Boring Stuff exercises with Python. Thanks for looking at my question.

+4
source share
1 answer

You called the pprint program. Rename your program to something other than pprint.py and delete any pprint.pyc file that may be present.

+9
source

All Articles