我得到了列表中的元组:
Contents = [{john, [jill,joe,bob]},
{jill, [bob,joe,bob]},
{sue, [jill,jill,jill,bob,jill]},
{bob, [john]},
{joe, [sue]}],
我想得到的打印是:
john: [jill,joe,bob]
jill: [bob,joe,bob]
sue: [jill,jill,jill,bob,jill]
bob: [john]
joe: [sue]
2条答案
按热度按时间xghobddn1#
You can try use
lists:foreach/2
or can try implement your own function for iteration and print out lists items:Custom function:
Lists generators:
cqoc49vn2#
You can simply iterate over the list in whatever way you like, and extract the tuples with pattern matching:
where
X
is the current item from your list. Then you can print them as desired.