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


Groups > comp.lang.python > #75027

Re: Why does not pprint work?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.019
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'subject:not': 0.03; 'subject:Why': 0.09; 'cc:addr:python-list': 0.11; '23,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'example': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; 'specify': 0.24; 'cc:2**0': 0.24; 'this:': 0.26; 'post': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'lines': 0.31; 'probably': 0.32; 'board': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'module.': 0.36; "didn't": 0.36; 'subject:?': 0.36; 'anything': 0.39; 'skip:p 20': 0.39; "you're": 0.61; 'website:': 0.67; 'jul': 0.74; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=ZBFqF4sZ6hTIio29igV8dTIZIis2BFWpsm1lpp7u7UY=; b=mfjPlLpDl2K4iyYtb4JiSRafnX+0+LKxcYvFdc24KgVzEqwFKwqdjo//6ZT5wjxHr9 2+ClXdeDjlu4HclBGi6KNCyv0FM9KtCrDuzv9eTC8DO3s25kSI7pnB8qQu1wuz70rk7k QLmA56ywRz7W+b7mqb+0EqjY5WVtJxQfdP1fjQxYg4v/c8r2r3Pt0nrmslbLl0JoGF4R 0E0QK9GpQUnl9eUhQ6cuq5ihn1N9//wSESQjt/qbpHiJHzZrWhATYROUBtpfMHDjCEY8 LrKU5N8AhYgQ+N+WHqqN/CKxKLdT1xSmsh6EKC8f75YpKpwQDueXp00b8Lm7XXPonH/b vvag==
MIME-Version 1.0
X-Received by 10.220.166.9 with SMTP id k9mr44909910vcy.20.1406065793295; Tue, 22 Jul 2014 14:49:53 -0700 (PDT)
In-Reply-To <6e09bc9c-d510-4076-b20d-32df796ca59e@googlegroups.com>
References <6e09bc9c-d510-4076-b20d-32df796ca59e@googlegroups.com>
Date Wed, 23 Jul 2014 07:49:53 +1000
Subject Re: Why does not pprint work?
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.12198.1406065796.18130.python-list@python.org> (permalink)
Lines 19
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1406065796 news.xs4all.nl 2864 [2001:888:2000:d::a6]:37383
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:75027

Show key headers only | View raw


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. :)

ChrisA

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