Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #75049

Re: Why does not pprint work?

From Ned Batchelder <ned@nedbatchelder.com>
Subject Re: Why does not pprint work?
Date 2014-07-22 22:26 -0400
References <6e09bc9c-d510-4076-b20d-32df796ca59e@googlegroups.com> <CAPTjJmq6_0JL8k0Pyr2Xd8J6S_T2D6KK5ft75s9KOpGmkSrD0A@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.12211.1406082429.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 7/22/14 5:49 PM, Chris Angelico wrote:
> On Wed, Jul 23, 2014 at 7:42 AM, fl <rxjwg98@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Why does not pprint work? fl <rxjwg98@gmail.com> - 2014-07-22 14:42 -0700
  Re: Why does not pprint work? Chris Angelico <rosuav@gmail.com> - 2014-07-23 07:49 +1000
  Re: Why does not pprint work? emile <emile@fenx.com> - 2014-07-22 14:51 -0700
    Re: Why does not pprint work? fl <rxjwg98@gmail.com> - 2014-07-22 15:05 -0700
      Re: Why does not pprint work? emile <emile@fenx.com> - 2014-07-22 15:17 -0700
      Re: Why does not pprint work? Chris Angelico <rosuav@gmail.com> - 2014-07-23 08:19 +1000
      Re: Why does not pprint work? Chris Kaynor <ckaynor@zindagigames.com> - 2014-07-22 15:22 -0700
  Re: Why does not pprint work? Ned Batchelder <ned@nedbatchelder.com> - 2014-07-22 22:26 -0400
  Re: Why does not pprint work? Chris Angelico <rosuav@gmail.com> - 2014-07-23 15:05 +1000
  Re: Why does not pprint work? robkotenko@gmail.com - 2014-08-03 14:34 -0700
    Re: Why does not pprint work? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-03 23:49 +0100

csiph-web