Prettyprint (or pretty-print) is the application of any of various stylistic formatting conventions to text, source code, markup, and other similar kinds of content. These formatting conventions usually consist of changes in positioning, spacing, color, contrast, size and similar modifications intended to make the content easier for people to view, read and understand.
Questions tagged [pretty-print]
1047 questions
54
votes
7 answers
How to see a large JSON file pretty printed on Ubuntu?
I would like to hear your suggestions on how to handle a large (40MB) JSON file on Ubuntu. I would like to see it pretty printed in vim or gedit or any other editor. One can find numerious tutorials on how to prettify the JSON, however, they do not…

JJD
- 50,076
- 60
- 203
- 339
53
votes
4 answers
Print a list of space-separated elements
I have a list L of elements, say natural numbers. I want to print them in one line with a single space as a separator. But I don't want a space after the last element of the list (or before the first).
In Python 2, this can easily be done with the…

nickie
- 5,608
- 2
- 23
- 37
49
votes
2 answers
Formatting Ruby's prettyprint
Is it possible to change the width that prettyprint (require 'pp') uses when formatting output? For example:
"mooth"=>["booth", "month", "mooch", "morth", "mouth", "mowth", "sooth", "tooth"]
"morth"=>["forth",
"mirth",
"month",
"mooth",
…

Myrddin Emrys
- 42,126
- 11
- 38
- 51
48
votes
3 answers
Pandas printing ALL dtypes
This seems like a very simple problem, however it's driving me round the bend. I'm sure it should be solved by RTFM, but I've looked at the options and I can see the one to fix it.
I just want to print the dtypes of all columns, currently I'm…

SColvin
- 11,584
- 6
- 57
- 71
47
votes
5 answers
Javascript console.log(object) vs. concatenating string
I'm running this in node.js:
> x = { 'foo' : 'bar' }
{ foo: 'bar' }
> console.log(x)
{ foo: 'bar' }
undefined
> console.log("hmm: " + x)
hmm: [object Object]
undefined
What I don't understand is why console.log(x) "pretty-prints" the object,…

John Zwinck
- 239,568
- 38
- 324
- 436
46
votes
3 answers
Is there a PowerShell code formatter / pretty printer?
I'm looking for a source code beautifyer for PowerShell programs. Ideally, it would be CLI based, but any solution is acceptable. I would like to avoid configuring a generic pretty printer tool; I'd like a solution that works for PowerShell out of…

Sleepless
- 1,097
- 2
- 11
- 11
45
votes
3 answers
Preferred method for viewing code generated by Template Haskell
As you know, Template Haskell is used to generate various kinds of AST splices programmatically at compile-time.
However, a splice can often be very opaque, and it is often difficult to discern what a splice actually generates. If you run the Q…

dflemstr
- 25,947
- 5
- 70
- 105
45
votes
2 answers
Pretty print json but keep inner arrays on one line python
I am pretty printing a json in Python using this code:
json.dumps(json_output, indent=2, separators=(',', ': ')
This prints my json like:
{
"rows_parsed": [
[
"a",
"b",
"c",
"d"
],
…

Ben Sandler
- 2,223
- 5
- 26
- 36
44
votes
4 answers
Prettyprint to a file?
I'm using this gist's tree, and now I'm trying to figure out how to prettyprint to a file. Any tips?

James.Wyst
- 859
- 3
- 8
- 13
42
votes
7 answers
How to Pretty print VBA code?
How do you copy VBA code into a Word document and retain the VBA editor color scheme?

mraviator
- 4,034
- 9
- 38
- 51
40
votes
1 answer
Which pretty print library?
So from a glance at hackage I can see 5 pretty printing libraries:
good old HughesPJ in pretty
wl-pprint-extras
wl-pprint-terminfo
wl-pprint
ansi-wl-pprint
wl-pprint-text
Oh wait, was that 6? 6 pretty printing libraries... no wait, we'll come in…

Evan Laforge
- 979
- 6
- 11
40
votes
2 answers
Pretty print in lxml is failing when I add tags to a parsed tree
I have an xml file that I'm using etree from lxml to work with, but when I add tags to it, pretty printing doesn't seem to work.
>>> from lxml import etree
>>> root = etree.parse('file.xml').getroot()
>>> print etree.tostring(root, pretty_print =…

Kris Harper
- 5,672
- 8
- 51
- 96
40
votes
6 answers
Disabling sorting mechanism in pprint output
I have big dictionary which I`m printing for viewing with prettyprint, but how I can keep formatting but kill sorting mechanism in pprint?

Edd
- 665
- 1
- 5
- 13
39
votes
2 answers
Chrome Dev Tools - can I always have pretty print enabled?
As part of our build the code is minimised I'm currently debugging some js and constantly have to click the pretty print button in chrome dev tools. Is there a way to permanently enable pretty printing in chrome dev tools ?

wmitchell
- 5,665
- 10
- 37
- 62
38
votes
9 answers
Is there a pretty printer / code formatter for C# (as part of build system)?
Is there a pretty printer / code formatter for C# (as part of build system)? Read as: "lives outside of Visual Studio". It seems like there are plenty of these kinds of things for Java, C++/C, Go -- so it seems more than reasonable that C# should…

lucidquiet
- 6,124
- 7
- 51
- 88