How to print similar tabular process output?

How can I print a similar tabular process output in my code? (make them aligned)

        Nodes      |    B&B Tree     |            Objective Bounds              |  Dynamic Constraints |       Work      
     Proc. InQueue |  Leaves   Expl. | BestBound       BestSol              Gap |   Cuts   InLp Confl. | LpIters     Time

         0       0         0   0.00%   39566           -inf                 inf        0      0      0         0     0.0s
 R       0       0         0   0.00%   20805.9428      18034             15.37%        0      0      0        16     0.0s
 H       0       0         0   0.00%   19569.94916     18034              8.52%       88     11      3        41     0.1s

See PrettyTables.jl

1 Like

Thanks a lot!

But it seems that it can’t print the process info line by line. :thinking:

How to print the process info line by line in a loop?

I don’t think that’s possible. PrettyTables need you to pass the whole table at once; otherwise, it would not be possible to determine the column widths to make sure everything is nicely aligned.

If that does not suit you, you can try printing the table manually using Printf, e.g.,

using Printf
for (label, value) in zip(["abcdef", "ghi"], [123.4, 5678.9])
    @printf "%10s   %8d  \n" label value
end
1 Like

See also Format.jl.

1 Like