企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
![](images/screenshot_1534761017270.png) ```erlang io:get_line io:get_line( "gissa line>" ). gissa line> fdfdsfdfdsfds. "fdfdsfdfdsfds.\n" io:get_chars io:get_chars( "me>",4 ). me>fdfdfdfd. "fdfd" fdfd io:read( "ok,aa>>" ) io:read( "ok,aa>>" ). ok,aa>>atom. {ok,atom}. io:fwrite("843 Error"). io:fwrite("843 Error"). 843 Errorok io_lib:format("~32.16.0b", [Mac])). 格式化"~32.16.0b"的含义,输出的用长度length为32,转化为16进制,转化时如果遇到空的位,使"0"填充, b输出的英文小写字母,B输出大写字母 %完整的格式化"~Length.P.PadC" Length输出宽度 P输出精度 Pad填充字符 C是控制字符 io:format( "~c~p~n~f~e~w~p~w~p~B" ) ~ The character ~ is written. c 参数必须是ASCII码,控制输出的精度 io:format( "|~-10.1c|", [$c] ). io:format( "|~10.1c|", [$c] ). f 参数必须是float, 输出一个有6个小数位的浮点数 e [-]d.ddde+-ddd, 输出一个以科学记数法表示的总共6位的浮点数 g s 字符串 w Writes data with the standard syntax. p 相比w更加格式化的输出 W P B 2..36进制输出一个integer,默认10进制 X # b x + n换行符 i io:format( "~ts~n", ["余健"] ) -> "余健" %%1. 打印浮点型 lists:flatten(io_lib:format("~.*..f", [2, S])); 3> lists:flatten(io_lib:format("~.*..f", [2, 192.2225])). "192.22" 4> lists:flatten(io_lib:format("~.*..f", [3, 192.2225])). "192.223" 5> lists:flatten([io_lib:format("~8.2.0B,", [L]) || L <- [1,2,3]]). "00000001,00000010,00000011," 6> lists:flatten([io_lib:format("~2.16.0B ", [L]) || L <- [1,2,3]]). "01 02 03 ". ```