如何预打印Erlang术语以使其可读?

如何预打印Erlang术语以使其可读?,erlang,Erlang,假设我有一个Erlang术语: {{badmatch,{error,enoent}},[{ts_config_http,parse_config,2,[{file,"src/tsung_controller/ts_config_http.erl"},{line,63}]},{lists,foldl,3,[{file,"lists.erl"},{line,1261}]},{ts_config,parse,2,[{file,"src/tsung_co

假设我有一个Erlang术语:

{{badmatch,{error,enoent}},[{ts_config_http,parse_config,2,[{file,"src/tsung_controller/ts_config_http.erl"},{line,63}]},{lists,foldl,3,[{file,"lists.erl"},{line,1261}]},{ts_config,parse,2,[{file,"src/tsung_controller/ts_config.erl"},{line,437}]},{lists,foldl,3,[{file,"lists.erl"},{line,1261}]},{ts_config,handle_read,3,[{file,"src/tsung_controller/ts_config.erl"},{line,85}]},{ts_config,read,2,[{file,"src/tsung_controller/ts_config.erl"},{line,70}]},{ts_config_server,handle_call,3,[{file,"src/tsung_controller/ts_config_server.erl"},{line,206}]},{gen_server,try_handle_call,4,[{file,"gen_server.erl"},{line,607}]}]}

如何将此术语预打印到宽度为80?

我将把术语另存为
term
,然后使用

1>Term={{badmatch,{error,enoint},[{ts_-config_-http,parse_-config,2,[{file,…}
2> io:格式(“~80p~n,[Term])。
{{badmatch,{error,enoint}},
[{ts_config_http,parse_config,2,
[{文件,“src/tsung_controller/ts_config_http.erl”},
{line,63}]},
{lists,foldl,3,[{file,“lists.erl”},{line,1261}]},
{ts_config,parse,2,[{file,“src/tsung_controller/ts_config.erl},{line,437}]},
{lists,foldl,3,[{file,“lists.erl”},{line,1261}]},
{ts_config,handle_read,3,
[{file,“src/tsung_controller/ts_config.erl”},{line,85}]},
{ts_config,read,2,[{file,“src/tsung_controller/ts_config.erl},{line,70}]},
{ts_config_server,handle_call,3,
[{文件,“src/tsung_controller/ts_config_server.erl”},
{line,206}]},
{gen_server,try_handle_call,4,[{file,“gen_server.erl”},{line,607}]}
您可以使用:

1.5.58{,{,,{,{,{,{,{,{,{,{,[1,58]},{,{,{,{,{,[1,58,[1,58]},{,{,{,{,{,{,{,{,[1.1.1>1>1>1>1>1.1>1>1.1>1>1>1.1>1>1>1>1>1>1>1>1>1>1.1>1>1>1.1>1>1>1,1.1>1>1>1>1,1.1.1.1>1>1>1>1,1.1.1.1>1>1>1,1.1.1.1.1,1.1>1>1>1>1>1>1,1,1.1,1.1.1.1.1.1,1.1.1.1,1.1.1.44]},0,0},{text,“6”6“12312312312312312312312312312312312312312312312312312312312312312312312312312312312312313131313131313131313131313131313131313131313131313131313131313131313131313131313131313132SFSASAFaFaFaSFaFaSFaSDFFaSDFFaFaFaFaDFDFDFDFDFDF的“0”,0,0,0,虚假,0,0,假},0,0,0,0,假},,,,,,,{浮动,{浮动,{浮动,{浮动,{浮动,{浮动,{{浮动,{文本,{[[[文本,{文本,{文本,{文本,{文本,{[文本,{[文本,{[1,文本,[1,文本,[1,1,1,1,1,1,1,1,1,1,1,1,41浮点数,{文本,[7,7,9797110100,9711010,9711010,9711010,9710万万万万万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万11 11 11 11 11 11 11 11 11 11 11,10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10万10 10万10 10万10万10万10万10万10 10 10万10万10 10万10 10万10 10 10 10 10 10 10万10 10 10 10 10 10 10 10 10 10万10 10 10 10 10 10 10,{除此之外,{除此之外,{text,[4116104,97116]},{除此之外,{text,[1,58]},{text,[511101101100115]},{text,[1,40]},{除此之外,{sep,[{text,“indenting”}],0,false},{float,{text,[1,41]},0,0},{text,[1,41]},{float,{。 [{旁边,{旁边,{旁边,{文本,{某物}, {除此之外,{text,[1,58]},{text,“very_long”}}, {文本,[1,40]}, {旁边,{sep,[{旁边,{text,[5,98,97115101100]}, {float,{text[1,44]},0,0}, {旁边,{text,[21111110]},{float,{text,[1,44]},0,0}, {除{文本[7,801114101100,79110101]}外, {float,{text[1,44]},0,0}, {文本,“6\”1231313123123123132SFSAFSAFASDFASDFASDFASDFDFDFDF\“”], 0,false}, {float,{text[1,41]},0,0}}, {float,{text[7,97110100,97108115111]},0,0}, {文本[7,801114101100,84119111]}, {float,{text[7,97110100,97108115111]},0,0}, {sep,[{text,[6,65,86,97108117101]}, {float,{text[3,61,58,61]},0,0}, {text,“something”}], 4,对}, {float,{text[7,97110100,97108115111]},0,0}, {上面,{旁边,{旁边,{text,“某物”}, {旁边,{text,[1,58]},{text,“\v潜在的”}}, {文本,[1,40]}, {nest,4, {旁边,{sep,[{上面,{旁边,{旁边,{文本,[4118101 |…]}, {旁边,{text,[…]},{text,…}}, {文本,[1,40]}, {nest,4,{nexted,{sep,[{…}],0,…},{float,{…},{…},}}], 0,false}, {float,{text[1,41]},0,0}] 2> rp(Ds)。 [{旁边,{旁边,{旁边,{文本,{某物}, {除此之外,{text,[1,58]},{text,“very_long”}}, {文本,[1,40]}, {旁边,{sep,[{旁边,{text,[5,98,97115101100]}, {float,{text[1,44]},0,0}, {旁边,{text,[21111110]},{float,{text,[1,44]},0,0}, {除{文本[7,801114101100,79110101]}外, {float,{text[1,44]},0,0}, {文本,“6\”1231313123123123132SFSAFSAFASDFASDFASDFASDFDFDFDF\“”], 0,false}, {float,{text,[1,41]},0,0}, {float,{text[7,97110100,97108115111]},0,0}, {文本[7,801114101100,84119111]}, {float,{text[7,97110100,97108115111]},0,0}, {sep,[{text,[6,65,86,97108117101]}, {float,{text[3,61,58,61]},0,0}, {text,“something”}], 4,对}, {float,{text[7,97110100,97108115111]},0,0}, {在上面,{在旁边,{在旁边,{文本,“某物”}, {旁边,{text,[1,58]},{text,“\v潜在的”}}, {文本,[1,40]}, {nest,4, 除此之外,{sep,[{上面,{旁边,{旁边,{文本,[4118101114, 121]}, {旁边,{text[1,58]},{text[4108111110103]}, {文本,[1,40]}, {nest,4, 除此之外,{sep,[{next,{next,{next,{text,[4116104,97, 116]}, {旁边,{text[1,58]},{text[511101100115]}}, {文本,[1,40]}, {除{sep,[{text,“缩进”}],0,false},