Why does not pprint work?

Ned Batchelder ned at nedbatchelder.com
Tue Jul 22 22:26:55 EDT 2014


On 7/22/14 5:49 PM, Chris Angelico wrote:
> 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. :)

Done.

>
> ChrisA
>


-- 
Ned Batchelder, http://nedbatchelder.com




More information about the Python-list mailing list