Python loop through list starting at index -


i looking more pythonic way loop though list starting an index return values contained in sub-lists eg:

values = [[1,2], [2], [1,3,4]] n=1 i, item in enumerate(values[n:]):     += n     if < len(values):         sub_value in values[i]:             print("index: "+str(i)+ " list: "+str(item)+ " sub value: "+str(sub_value)) 

the code works intended pretty ugly, ideas simplify it?

i'm not sure understand trying achieve.if want print flat list of items index 1 this:

[item sublist in values[1:] item in sublist] 

which produces:

[2, 1, 3, 4] 

Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -