2011-12-27 39 views

回答

8

[binary_to_list(X) || X <- [<<"a">>, <<"b">>, <<"c">>]].或更复杂的

 
BinList = [<<"a">>, <<"b">>, <<"c">>], 
NormalList = [binary_to_list(X) || X <- BinList], 
NormalList. 

+1

链接binary_to_list实况:HTTP:/ /erldocs.com/R15B/erts/erlang.html?i=3#binary_to_list/1。 – kay 2011-12-30 10:40:33

+0

链接提供了404链接。推测这是当前位置http://erlang.org/doc/man/erlang.html#binary_to_list-1 – 2016-10-18 22:29:34

2

,你可以做这样的:

A=[<<"a">>, <<"b">>, <<"c">>] 
B=[binary_to_list(Item) || Item <- A] 
5

或者,使用列表:映射/ 2:

lists:map(fun erlang:binary_to_list/1, [<<"a">>, <<"b">>, <<"c">>]).