Slicing numpy array with another array

后端 未结 5 1227
青春惊慌失措
青春惊慌失措 2021-01-17 16:12

I\'ve got a large one-dimensional array of integers I need to take slices off. That\'s trivial, I\'d just do a[start:end]. The problem is that I need more of th

5条回答
  •  误落风尘
    2021-01-17 16:45

    If you want it in one line, it would be:

    x=[list(a[s:e]) for (s,e) in zip(start,end)]
    

提交回复
热议问题