I have a list of lists like this:-
x=[['A','B','C','D'],['E','F','G','H']]
I am trying to add an index to the list like this:-
y=[[0,'A','B','C','D'],[1,'E','F','G','H']]
Is there any way to achieve this?
y = [[i]+a for i,a in enumerate(x)]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With