创建2元素列表 -
["atom", "nuclei", "neuron"] to display as:
使用列表和结果计算数字以显示类似这样的内容=
[["atom",4], ["nuclei",6], ["neuron", 6], ["physics", 7]]
答案 0 :(得分:2)
下面:
>>> my_list = ["atom", "nuclei", "neuron"]
>>> [[v, len(v)] for v in my_list]
[['atom', 4], ['nuclei', 6], ['neuron', 6]]