Reputation: 372
I looked and couldn't find a similar question probably because I'm a python noob and don't know the proper language to search.
is there a way to do this...
frame_inds = [0, list(range(200, 2000, 100)), 3999]
the output I get is this
[0, [200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900], 3999]
but I want this
[0, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 3999]
so that it is all in one array?
in matlab you can do this var1 = [1, 2, 3:10:100, 400]
Upvotes: 3
Views: 350
Reputation:
I would simply concatenate the lists, using the +
operator.
frame_inds = [0]+list(range(200, 2000, 100))+[3999]
Upvotes: 2
Reputation: 2424
frame_inds = [0, *range(200, 2000, 100), 3999]
By using the *
operator you can unpack all its items and they become items in the main list.
Upvotes: 6