Why does not pprint work?

Chris Angelico rosuav at gmail.com
Tue Jul 22 17:49:53 EDT 2014


On Wed, Jul 23, 2014 at 7:42 AM, fl <rxjwg98 at gmail.com> wrote:
> I enter the example lines of that website:
>>> import pprint
> board = [ [0]*8 ] * 8
> pprint(board)

Flaw in the blog post: he didn't actually specify the import line.
What you actually want is this:
from pprint import pprint
Or use pprint.pprint(board), but you probably don't need anything else
from the module.
Ned, if you're reading this: Adding the import would make the post clearer. :)
ChrisA


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /