On Thu, Jun 9, 2022 at 1:52 PM Michael F. Stemper
wrote:
> On 09/06/2022 12.52, Chris Angelico wrote:
> > On Fri, 10 Jun 2022 at 03:44, Dave wrote:
>
> >> Before I write my own I wondering if anyone knows of a function that
> will print a nicely formatted dictionary?
> >>
> >> By nicely
On 2022-06-09, Dennis Lee Bieber wrote:
> However, the Gmane list<>NNTP gateway server DOES make the tutor
> list available to news readers (unfortunately, the comp.lang.python
> <> list <> Gmane has been read-only since last fall (unless things
> have changed recently) so I'm stuck with the
On 09Jun2022 21:35, Dave wrote:
>I quite like the format that JSON gives - thanks a lot!
Note that JSON output is JavaScript notation, not Python. The `pprint`
module (which has `pprint` and `pformat` functions) outputs Python
notation.
If you're just writing for human eyes, JSON is fine,
On 09/06/2022 12.52, Chris Angelico wrote:
On Fri, 10 Jun 2022 at 03:44, Dave wrote:
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!
If you want tables layed out in a framing grid, you might want to take a
look at this:
https://bitbucket.org/astanin/python-tabulate/pull-requests/31/allow-specifying-float-formats-per-column/diff
Frederic
On 6/9/22 12:43, Dave wrote:
Hi,
Before I write my own I wondering if anyone knows
Hi,
I quite like the format that JSON gives - thanks a lot!
Cheers
Dave
> On 9 Jun 2022, at 20:02, Stefan Ram wrote:
>
> Since nicety is in the eyes of the beholder, I would not
> hesitate to write a custom function in this case. Python
> has the standard modules "pprint" and "json".
>
>
On 6/9/22 11:52, Chris Angelico wrote:
> On Fri, 10 Jun 2022 at 03:44, Dave 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!
>>
>
>
Dave,
Despite your other programming knowledge, I suspect you think this is the forum
where people come to be tutored. Try here:
https://mail.python.org/mailman/listinfo/tutor
Yes, there are plenty of pretty printers available and you can build your own
function fairly easily. A module like
On Fri, 10 Jun 2022 at 03:44, Dave 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
On 2022-06-09 11:43, Dave 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!
It's called "pretty-printing". Have a look at the 'pprint' module.
--
On Thu, Jun 9, 2022 at 11:44 AM Dave 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!
>>> import json
>>> d = {'John': 'Cleese', 'Eric': "Idle", 'Micheal':
11 matches
Mail list logo