Display of dictionary contents to file

,

Use the 3-argument show, which is what display calls under the hood:

show(io, "text/plain", INP_PT_LB)

(I would also call your variable io rather than IO, since IO is a type in Julia and it is confusing to shadow it with a variable.)

If you want to limit the output, you wrap the io stream in an IOContext, e.g as IOContext(io, :limit => true), where the :limit option causes it to truncate large outputs. This works for both println (which calls 2-argument show) and for 3-argument show (although the two output formats may differ).

The next version of the manual will have a summary of how all these output functions relate, which you can view now on github.

2 Likes