ehoho

get item from index_in sublist

Aug 7th, 2017
784
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.12 KB | None | 0 0
  1. a=[[1,2,3,4],[5,6,7]]
  2. b_index=[1,0]
  3.  
  4. lst=[]
  5.  
  6. for ls,indx in zip(a,b_index):
  7.     sub=[ls[indx]] 
  8.     lst.append(sub)
  9.  
  10. OUT=lst
Advertisement
Add Comment
Please, Sign In to add comment