I am new to python and I have search a lot about this issue. I know there is a way of converting tuples to a list, but somehow it doesn't work for me. Here is my issue.
Say I have:
l_1 = ['a','b','c']
l_2 = ['e','f','g']
l_3 = ['g','h','i']
Then say I have another list of:
l_all = ['l_1','l_2','l_3']
How can I convert it(l_all) to a list of
[['a','b','c'],['e','f','g'],['g','h','i']]
I tried ast package using ast.literal_eval, but I received this error:
ValueError: malformed node or string: <_ast.Name object at 0x00000172CA3C5278>
I also tried to use json package, still no luck.
I tried just output ast.literal_eval('l_1')
, not working either.
I'd really appreciate if anyone can help on this.
Thanks a lot!