How to unpack a list into a single variable?

I have:
for i,j,k in [[1,2,3],[4,5,6]]:
 print i,j,k

As you can also nice to do the unpacking in one variable(and then immediately use it) in this case:
for i in [[1],[2]]:
 print i
April 4th 20 at 13:24
1 answer
April 4th 20 at 13:26
Solution
Add a comma: for i in [[1],[2]]:.
Thank you! How does it work? Type unpacking is always in a certain sequence and to indicate that in this case there is a sequence you need to add a comma? It's like (1,) says that will create a tuple, but (1) will be created int? - quentin_Stanton commented on April 4th 20 at 13:29
@quentin_Stanton, no idea. I don't know python. - Patrick.Mante83 commented on April 4th 20 at 13:32
@Patrick.Mante83, you just googled it? - quentin_Stanton commented on April 4th 20 at 13:35
@quentin_Stanton, no. - Patrick.Mante83 commented on April 4th 20 at 13:38

Find more questions by tags Python