Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:not': 0.03; 'correct.': 0.07; 'variables': 0.07; '22,': 0.09; 'name?': 0.09; 'subject:Why': 0.09; 'cc:addr:python-list': 0.11; '23,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'globals(),': 0.16; 'make,': 0.16; 'module?': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'module': 0.19; 'thanks.': 0.20; '>>>': 0.22; 'import': 0.22; 'python?': 0.22; 'cc:addr:python.org': 0.22; 'math': 0.24; 'cc:2**0': 0.24; 'this:': 0.26; 'second': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'invoke': 0.31; 'could': 0.34; 'case,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'curious': 0.36; "didn't": 0.36; 'subject:?': 0.36; 'two': 0.37; 'list': 0.37; 'pm,': 0.38; 'skip:p 20': 0.39; 'how': 0.40; 'then,': 0.60; 'first': 0.61; 'name': 0.63; 'july': 0.63; 'within': 0.65; 'jul': 0.74; 'kinda.': 0.84; 'start.': 0.84; '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=ZQ8ijAajhincPQZHjQBEVGb0KrvKTTkmr95qEZ0LDR4=; b=dGZga7AS9BBBOpwlwc2F+M+2qEz5k1xYztrnP86l+DoKf/7SRohSuUoe7e725LvoJT Xciq1C7D2t48E4JCwlmUtVl1KMswO73v7mj2TjEHAi6r5nrgqb9WbrI6faaGRx4lkfCm YJJSy1uZ2ouFFOP1wdMHulHGR5GsPrAd/ZqkmxBMB376bd5DBHtqQL7slUgOsbnKenDx vVo7JYv2PIW6pbGnojud0RMcNY26szF/2EjrsqC92WmiN8W01j5mojMSgou00aAkLE1Z /wPdpDS3seriY4FbDQqFxbU4HhPOmoW+d78uHH7QCjzxmOXZEEYbYZNXz90NiawlfDpT LLzA== MIME-Version: 1.0 X-Received: by 10.52.138.209 with SMTP id qs17mr16833234vdb.80.1406067585201; Tue, 22 Jul 2014 15:19:45 -0700 (PDT) In-Reply-To: References: <6e09bc9c-d510-4076-b20d-32df796ca59e@googlegroups.com> Date: Wed, 23 Jul 2014 08:19:45 +1000 Subject: Re: Why does not pprint work? From: Chris Angelico Cc: "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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 39 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1406067587 news.xs4all.nl 2957 [2001:888:2000:d::a6]:51826 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:75033 On Wed, Jul 23, 2014 at 8:05 AM, fl wrote: > On Tuesday, July 22, 2014 5:51:07 PM UTC-4, emile wrote: >> On 07/22/2014 02:42 PM, fl wrote: >> pprint is a module name -- you need to invoke the pprint function from >> within the pprint module: >> pprint.pprint(board) > > Thanks. I am curious about the two pprint. Is it the first pprint the name of the > module? The second pprint is the function name? Correct. There's a module pprint which provides a function pprint.pprint. It's like you can do this: >>> import math >>> math.sin(3.14/2) 0.9999996829318346 Or this: >>> from math import sin >>> sin(3.14/2) 0.9999996829318346 It's just that in this case, "math" and "sin" are both "pprint". > Then, how can I list all the function of pprint? >>> import pprint >>> help(pprint) > And, is there a way to list the variables I create in Python? Kinda. Try this: >>> dir() There'll be some in there that you didn't make, but that's a start. You could also try vars() or globals(), which will give you their values as well. ChrisA