# How to repeat the format in @printf?

**URL:** <https://discourse.julialang.org/t/how-to-repeat-the-format-in-printf/66695>\
**Category:** General Usage\
**Tags:** io\
**Created:** [August 19, 2021, 11:48pm UTC](https://discourse.julialang.org/t/how-to-repeat-the-format-in-printf/66695 "2021-08-19T23:48:58Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![CRquantum](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/crquantum/32/27824_2.png) [@CRquantum](https://discourse.julialang.org/u/CRquantum)\
**Post date:** [August 21, 2021, 6:45am UTC](https://discourse.julialang.org/t/how-to-repeat-the-format-in-printf/66695/12 "2021-08-21T06:45:12Z")

</div>

A quick thing, is it possible to print these stuff in a txt file?

I tried things like

```
f = Printf.Format("%9.3f"^4)
io = open("myfile.txt", "w")
for i in 1:10
    @printf(io, f, 1,2,3,4)
end
close(io)

```

But it does not work.

I expect to have a file called myfile.txt in which it should have such 5 lines,

```
1.000 2.000 3.000 4.000
1.000 2.000 3.000 4.000
1.000 2.000 3.000 4.000
1.000 2.000 3.000 4.000
1.000 2.000 3.000 4.000

```

Thank you!

---

_[View the full topic](https://discourse.julialang.org/t/how-to-repeat-the-format-in-printf/66695)._
