试试这个,你的代码没问题。只要改变最后一行,你就会得到列表。
input_list = [i.split(',') for i in keys]
# output:
# [['a', 'b', 'c', 'd'], ['z', 'x', 'w'], ['value_n', ' value_n+1', ' value_n+n']]
>>> input_list # you already have the values inside this variable
[['a', 'b', 'c', 'd'], ['z', 'x', 'w'], ['value_n', ' value_n+1', ' value_n+n']]
>>>
>>> input_list[0] # access the first element
['a', 'b', 'c', 'd']
>>>
>>> input_list[1] # access the second element
['z', 'x', 'w']
>>>
>>> input_list[2] # access the third element
['value_n', ' value_n+1', ' value_n+n']