# How to print similar tabular process output?

**URL:** https://discourse.julialang.org/t/how-to-print-similar-tabular-process-output/112928
**Category:** General Usage
**Tags:** question, prettytables, printf
**Created:** [April 14, 2024, 4:06pm UTC](https://discourse.julialang.org/t/how-to-print-similar-tabular-process-output/112928 "2024-04-14T16:06:08Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![WuSiren](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wusiren/32/42529_2.png) [@WuSiren](https://discourse.julialang.org/u/WuSiren)
#### Post date: [April 14, 2024, 4:06pm UTC](https://discourse.julialang.org/t/how-to-print-similar-tabular-process-output/112928/1 "2024-04-14T16:06:08Z")

</div>

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

```julia
        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

```

---

<div class="post-metadata">

### Author: ![barucden](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/barucden/32/26154_2.png) [@barucden](https://discourse.julialang.org/u/barucden)
#### Post date: [April 14, 2024, 5:47pm UTC](https://discourse.julialang.org/t/how-to-print-similar-tabular-process-output/112928/2 "2024-04-14T17:47:47Z")

</div>

See PrettyTables.jl

---

<div class="post-metadata">

### Author: ![WuSiren](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wusiren/32/42529_2.png) [@WuSiren](https://discourse.julialang.org/u/WuSiren)
#### Post date: [April 15, 2024, 3:01am UTC](https://discourse.julialang.org/t/how-to-print-similar-tabular-process-output/112928/3 "2024-04-15T03:01:17Z")

</div>

Thanks a lot!

---

<div class="post-metadata">

### Author: ![WuSiren](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wusiren/32/42529_2.png) [@WuSiren](https://discourse.julialang.org/u/WuSiren)
#### Post date: [April 16, 2024, 3:41am UTC](https://discourse.julialang.org/t/how-to-print-similar-tabular-process-output/112928/4 "2024-04-16T03:41:12Z")

</div>

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

---

<div class="post-metadata">

### Author: ![WuSiren](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wusiren/32/42529_2.png) [@WuSiren](https://discourse.julialang.org/u/WuSiren)
#### Post date: [April 16, 2024, 5:51am UTC](https://discourse.julialang.org/t/how-to-print-similar-tabular-process-output/112928/6 "2024-04-16T05:51:58Z")

</div>

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

---

<div class="post-metadata">

### Author: ![barucden](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/barucden/32/26154_2.png) [@barucden](https://discourse.julialang.org/u/barucden)
#### Post date: [April 16, 2024, 7:29am UTC](https://discourse.julialang.org/t/how-to-print-similar-tabular-process-output/112928/7 "2024-04-16T07:29:24Z")

</div>

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.,

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

```

---

<div class="post-metadata">

### Author: ![jar1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jar1](https://discourse.julialang.org/u/jar1)
#### Post date: [April 16, 2024, 7:33am UTC](https://discourse.julialang.org/t/how-to-print-similar-tabular-process-output/112928/8 "2024-04-16T07:33:03Z")

</div>

See also Format.jl.
