How to use a 'for' loop to iterate nested-list index items in Python 2.7? -


i have list this:

nlist = [[0,0,0],[3,2,1]],\ [[]],\ [[100,1000,110]],\ [[0,0,0],[300,400,300],[300,400,720],[0,0,120],[100,0,1320],[30,500,1450]]  

and need store outputs in such manner every variable before '\' comes out this, example, before 1st '\':

0 metres, 0 metres, 0 seconds 3 metres, 2 metres, 1 seconds 

i have come far individual indexes before each '\', example nlist[4]:

outputlist = []  distance in nlist[4]:     outputllist.append('{} metres, {} metres, {} seconds'.format(*distance)) 

but how create for loop iterates on nlist indexes , stores output in format 'x' metres, 'y' metres, 't' seconds in empty list outputlist?

thanks help.

for in range(1,len(nlist)):     distance in nlist[i]:         outputllist.append('{} metres, {} metres, {} seconds'.format(*distance)) 

i think you're asking.


Popular posts from this blog