Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Consistency requires you to be as ignorant today as you were a year ago." -- Bernard Berenson


devel / comp.lang.python / Re: Function to Print a nicely formatted Dictionary or List?

SubjectAuthor
o Re: Function to Print a nicely formatted Dictionary or List?Mats Wichmann

1
Re: Function to Print a nicely formatted Dictionary or List?

<mailman.603.1654801292.20749.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18564&group=comp.lang.python#18564

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: mat...@wichmann.us (Mats Wichmann)
Newsgroups: comp.lang.python
Subject: Re: Function to Print a nicely formatted Dictionary or List?
Date: Thu, 9 Jun 2022 13:01:16 -0600
Lines: 25
Message-ID: <mailman.603.1654801292.20749.python-list@python.org>
References: <6C7CEF1D-A810-44E0-8A23-6B34916C308D@looktowindward.com>
<CAPTjJmogFndKX5bUXB3vS7VyN9KDeBtZoE97gqcnFJM5Ay6+MA@mail.gmail.com>
<a92065af-0d0a-1576-ade8-b44bc3f8d4f7@wichmann.us>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de IruhlwZbFz7cD920582DJw6uRPg+GBYbBFZcYKLuGnjw==
Return-Path: <mats@wichmann.us>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="1024-bit key; unprotected key"
header.d=pobox.com header.i=@pobox.com header.b=lusx1AuA;
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.005
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'knows': 0.04; '2022':
0.05; 'thread': 0.05; 'angelico': 0.09; 'url-ip:184.105.176/24':
0.09; 'url-ip:184.105/16': 0.09; 'url:discuss': 0.09;
'received:173': 0.13; 'import': 0.15; 'chrisa': 0.16; 'wrote:':
0.16; 'to:addr:python-list': 0.20; 'fri,': 0.22; 'anyone': 0.25;
'jun': 0.26; 'function': 0.27; 'board': 0.28; 'chris': 0.28;
'output': 0.28; 'header:User-Agent:1': 0.30; 'wondering': 0.31;
'gotten': 0.32; 'but': 0.32; 'there': 0.33; 'mean': 0.34; 'header
:In-Reply-To:1': 0.34; 'following': 0.35; 'received:192.168':
0.37; 'choose': 0.67; 'subject:List': 0.71; 'url:t': 0.73;
'discuss': 0.78; 'choices': 0.84; 'that...': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=message-id
:date:mime-version:subject:to:references:from:in-reply-to
:content-type:content-transfer-encoding; s=sasl; bh=c2C906OQIPWZ
r2i0xoomR10ojRWGiGoMVUPhgn0KUwk=; b=lusx1AuA1jf8rBz+0BTOWKJCtzjL
aII7gsigPfXL2RBZd0d1Xjnd24dgzE7wwm1gQEwqR0h7Aecy8wQyowSiQB/AePkZ
0aDYweN4L7CrEBtqCPAwAiILPBK9QunF3doJy73LQt2byUxBw/smcCjpkwOzaGpV
qG2i/Actzsa3+Kk=
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=wichmann.us;
h=message-id:date:mime-version:subject:to:references:from:in-reply-to:content-type:content-transfer-encoding;
s=2018-07.pbsmtp; bh=c2C906OQIPWZr2i0xoomR10ojRWGiGoMVUPhgn0KUwk=;
b=ryPnfP39g4t5I/O5dQReJiISh4akn104aR7rw6Xuwzh6Hevdw2l0YSaiEjV/bs8jRtR+wOwu5IuA2z3lG6O/2m3/F5uvqD++auA7nmdgJmwC9205OXIP/8Vp7ZxiAZS4hXQIlMe/zecW1L68nGgMG2lIVgSsk0dCH/WxlWLwTB0=
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.10.0
Content-Language: en-US
In-Reply-To: <CAPTjJmogFndKX5bUXB3vS7VyN9KDeBtZoE97gqcnFJM5Ay6+MA@mail.gmail.com>
X-Pobox-Relay-ID: 8B73D45C-E826-11EC-827C-CBA7845BAAA9-81526775!pb-smtp21.pobox.com
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
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: <https://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>
X-Mailman-Original-Message-ID: <a92065af-0d0a-1576-ade8-b44bc3f8d4f7@wichmann.us>
X-Mailman-Original-References: <6C7CEF1D-A810-44E0-8A23-6B34916C308D@looktowindward.com>
<CAPTjJmogFndKX5bUXB3vS7VyN9KDeBtZoE97gqcnFJM5Ay6+MA@mail.gmail.com>
 by: Mats Wichmann - Thu, 9 Jun 2022 19:01 UTC

On 6/9/22 11:52, Chris Angelico wrote:
> On Fri, 10 Jun 2022 at 03:44, Dave <dave@looktowindward.com> wrote:
>>
>> Hi,
>>
>> Before I write my own I wondering if anyone knows of a function that will print a nicely formatted dictionary?
>>
>> By nicely formatted I mean not all on one line!
>>
>
> https://docs.python.org/3/library/pprint.html
>
> from pprint import pprint
> pprint(thing)
>
> ChrisA

I might add the note that there was a recent thread on the Discuss board
about options for styling the pprint output (okay, it was me that
started that one...) - you can choose indent and compact (compact is the
not-all-on-one-line flag) but there might be some other choices missing.
haven't gotten around to following up on that...

https://discuss.python.org/t/pprint-styling-options/15947

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor