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.
pretty-print
1,064
questions
2
votes
3
answers
55
views
Is there a way to read sequentially pretty-printed JSON objects in Python?
Suppose you have a JSON file like this:
{
"a": 0
}
{
"a": 1
}
It's not JSONL, because each object takes more than one line. But it's not a single valid JSON object either. It'...
0
votes
0
answers
31
views
ABAP: Generate class with SEO_CLASS_CREATE_COMPLETE with pretty printer
I'm using the Function Module SEO_CLASS_CREATE_COMPLETE to generate classes, but the problem is, that it doesn't do Pretty-print on the source code.
Q:
Is there a way to make the FM do Pretty-print?
...
2
votes
1
answer
64
views
Pretty print application (Lambda-calculus)
I want to pretty print an AST of lambda-terms. Therefore, I am creating show instances in order to achieve this, but I am having one problem. Whenever I print applications, I obviously lose the ...
1
vote
1
answer
102
views
How to view C++ arrays in VS Code debugger
I'm using the Microsoft's C/C++ extension for debugging and the outputs for arrays look like:
If something changes in the array, I have to click to see inside.
How can I make it show all the elements ...
0
votes
1
answer
312
views
How do I print each element in an openai ChatCompletion response as JSON on a separate line?
I'm making a simple call to OpenAI using Python asking about where a baseball game was played.
completion = openai.chat.completions.create(
model="gpt-3.5-turbo",
messages = [
{"...
1
vote
0
answers
45
views
Python3 custom pretty printer for derived class objects?
I have attempted to make a pretty printer for a number of objects deriving from a class; but I have arrived at some behavior that puzzles me - I hope I can get some help to understand (and fix) it. ...
1
vote
1
answer
76
views
HTML::Element endtag generates end tags for <br> and <img>
I'm using the following Perl code to traverse and format some HTML:
#!/usr/bin/env perl
use v5.38;
use HTML::TreeBuilder;
my $indent = 3;
my $content = do {local $/; <DATA>};
my $tree = HTML::...
0
votes
1
answer
55
views
How to save a xml structure using python tree.write(file_name)? [duplicate]
I wanted to add Element with Subelements to my xml file using Python. But after changing file the Element and Subelement looks like a line, not like a xml-tree.
I do this:
tree = ET.parse('...
2
votes
2
answers
102
views
How to add spaces to pretty print pseudo-code?
I'm trying to indent a pseudo-code that I have column A and is not indented. Basically I'm trying to add 4 spaces when is time to do it even is there is a nested if/elseif/else/end block or while/end ...
0
votes
0
answers
67
views
jq equivalent in power shell with indentation [duplicate]
I am successfully using jq.exe installed on my windows with choco install jq:
$ echo '{"class": [{"name": "oren", "age": 6},{"name": "moish",...
-1
votes
1
answer
91
views
Rust pretty print with alignment
Like {:0>6} for alignment of a normal debug or display print, is there a way to align a pretty print with {:#?} in Rust?
Tried:
println!("{:#?0>6}", 123);
Expected the output:
000123
0
votes
2
answers
112
views
Common Lisp formatting/indentation
(defun heapify-down (heap-id
index)
(if
(is-leaf heap-id
index)
nil
(let ((left (left-child index))
(right (right-child index))
...
0
votes
0
answers
82
views
Is there a nice way to "pretty escape" bash strings?
First of all: I know that the easiest way to print an escaped version of a string of course would be
printf "%q" "$arg"
But I don't consider the output generally "human ...
2
votes
2
answers
1k
views
Log a dataframe using logging and pandas
I am using pandas to operate on dataframes and logging to log intermediate results, as well as warnings and errors, into a separate log file. I need to also print into the same log file a few ...
1
vote
1
answer
44
views
How to print formatted JSON value in Ballerina
Please run the following example code.
import ballerina/io;
public function main() {
json j = {"id": 1, "name": "John", "address": {"city": "...