[erlang-questions] Question re io:format and string handling

Richard Carlsson <>
Fri Oct 17 16:53:06 CEST 2008


David Cabana wrote:
> Consider the result of evaluating the following in an erl console:
> io:format("The ~p in the ~p", ["cat", "hat"]).
> 
> The Python idiom is useful, and I have been looking for something
> similar in Erlang, without luck.  Before I try to concoct such a thing,
> I thought I'd ask whether it already exists.

Use the io_lib module instead:

Text = io_lib:format("The ~p in the ~p", ["cat", "hat"]).


    /Richard



More information about the erlang-questions mailing list