Questions tagged [pretty-print]

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.

1047 questions
-1
votes
1 answer

How to effectively print white space as necessary to the task in my prettyPrint() BST method

For the pretty print method of my BST class, we were told by our lecturer for the tree: bst.put(7, 7); // _7_ bst.put(8, 8); // / \ bst.put(3, 3); // _3_ 8 bst.put(1, 1); // / \ bst.put(2, 2);…
roughosing
  • 71
  • 11
-1
votes
1 answer

Pretty print and write XML with UTF-8 encoding in Java 8

I have a XML document in a String and would like to prettyPrint (newlines after tags and indentation) it to a file, so far the solution at https://stackoverflow.com/a/25865324/3229995 is working for me almost as I want. The problem is, it is using…
tkja
  • 1,950
  • 5
  • 22
  • 40
-1
votes
1 answer

pretty print in mongo shell not working - MongoDB 2.6 + Yosemite + ZSH

I'm running the mongo shell by invoking mongo at the command line. The result is a bland shell experience. I would like to see colored JSON output, etc. I tried running: > db.my_collection.find().pretty() but it didn't work. I also tried adding…
tadasajon
  • 14,276
  • 29
  • 92
  • 144
-1
votes
3 answers

Print an array the way it is written in code?

I'm generating localization files in Laravel that look something like this: 'world', 'foo' => 'bar', ]; Just a normal array, nothing fancy. I'm looking for a way to do this, I've looked at the serialize method but it…
Helen Che
  • 1,951
  • 5
  • 29
  • 41
-1
votes
2 answers

Pretty print complex JSON input

I have gone through How can I pretty-print JSON in (unix) shell script? and other Stackoverflow posts on "pretty print JSON" but they are only good for simple inputs like, echo '{"foo": "lorem", "bar": "ipsum"}' | python -m json.tool When I try to…
Saurabh Rana
  • 3,350
  • 2
  • 19
  • 22
-1
votes
2 answers

arrange your string in python

for k, v in country_cap_dict.items(): print "%s : %s" % (k,v) my for loop is giving me output like this US : Washington Canada : Ottawa Germany: Berlin France : Paris England : London …
tryPy
  • 71
  • 1
  • 11
-1
votes
2 answers

Regular expression for correct comma formatting

I'm trying to make a regular expression that change all common incorrect comma formating to a correct one in a text file - don't want to find correct comma formating. Finds a comma that has at least one space before and any after (edited: changed *…
LeoD3
  • 195
  • 10
-1
votes
1 answer

Automated extraction of word docx archive and pretty print conversion of xml files

If renaming eg. a file document.docx to document.docx.unzipped.zip it is possiple to extract that archive eg. to a folder 'document.docx.unzipped'. Unfortunatly the extracted xml-files are not very readable since all xml-information is in one single…
grenix
  • 623
  • 7
  • 15
-1
votes
2 answers

Printing Comments in Python with integers

def triangular(n): tri = 0 for i in range(1, n+1): tri = tri + i print ("The answer is equal to" +(tri)) triangular(4) I just need help with the print statement because it doesn't work. I am trying to print the answer is equal…
user3204229
  • 75
  • 1
  • 9
-1
votes
1 answer

Json php formatting

I have json output written in php. "; $db_user = ""; $db_password = ""; $db_name = ""; $db = mysql_connect($db_host, $db_user, $db_password); if…
Atlas91
  • 5,754
  • 17
  • 69
  • 141
-2
votes
1 answer

How do I minify Delphi code using Delphi?

The title might be a bit confusing, but basically, I want a function that can minify Delphi code. Something like this: function MinifyDelphiCode(delphi: String): String; begin // Returns the minified Delphi (.pas) code String end; Is there by any…
Shaun Roselt
  • 1,650
  • 5
  • 18
  • 44
-2
votes
1 answer

Pretty print unexported fields using '%v'

It seems at that at least the default libs for printing, i.e., fmt, can't pretty print unexported fields of structs. There's probably a logical reason for this. See the following example: package main import ( "fmt" …
hbogert
  • 4,198
  • 5
  • 24
  • 38
-2
votes
1 answer

Python pp a Json config file

i try to Pretty print a JSON file, like i have a login system and the "Data" should get save there. But if i use with open('authentication.json', 'w+') as outfile: json.dump(data, outfile) It outputs {"username": "censored",…
LQ MK OnFire
  • 49
  • 3
  • 9
-2
votes
3 answers

Pretty printing table format of hashmap java

Say we have a HashMap of keys and values, where keys are Integers and values are Lists, then I throw construct a treeMap using the hashMap to put it in order: Map> map = new HashMap<>(); Map> orderedMap…
IHaveAQuestion
  • 143
  • 2
  • 12
-2
votes
1 answer

How to pretty-print a Python list with indices?

How can I pretty-print a (possibly nested) Python list with indices, similar to the Perl's Data::Printer module, e.g. for L = ['a', 'b', None, 'c'] the output should be something like this: [ [0] 'a', [1] 'b', [2] None, [3] 'c', ]
planetp
  • 14,248
  • 20
  • 86
  • 160
1 2 3
69
70