Concatenate list and number in a sublist in Python -


this question has answer here:

how concatenate list such this:

buttons = [[['a','b','c'], '2'], [['d','e','f'], '3']] 

into

buttons = [[['a','b','c','2'], ['d','e','f','3']]] 

i tried accessing 3 indexes , concatenating didn't work:

buttons[0][1] 

>>> import itertools >>> l = [[['a','b','c'], '2'], [['d','e','f'], '3']] >>> [list(itertools.chain.from_iterable(i)) in l] [['a', 'b', 'c', '2'], ['d', 'e', 'f', '3']] 

Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -