So, I have a list of dictionaries that constitutes frames information in the form of a list of dictionaries. list is sorted as per "frame_num" key
[
{ "frame_num": "1","width": "1920","height":"1080","other_info": "some_info" },
{ "frame_num": "2","width": "1920","height":"1080","other_info": "some_info" },
{ "frame_num": "3","width": "1920","height":"1080","other_info": "some_info" },
{ "frame_num": "4","width": "1920","height":"1080","other_info": "some_info" },
{ "frame_num": "6","width": "1920","height":"1080","other_info": "some_info" },
{ "frame_num": "8","width": "1920","height":"1080","other_info": "some_info" },
{ "frame_num": "10","width": "1920","height":"1080","other_info": "some_info" },
{ "frame_num": "15","width": "1920","height":"1080","other_info": "some_info" },
{ "frame_num": "16","width": "1920","height":"1080","other_info": "some_info" },
{ "frame_num": "18","width": "1920","height":"1080","other_info": "some_info" },
{ "frame_num": "20","width": "1920","height":"1080","other_info": "some_info" },
{ "frame_num": "22","width": "1920","height":"1080","other_info": "some_info" }
]
So, I want to fetch a list of frames who's frame_num values are in the range of 4:14 that is a slice of a list with this range my answer will be
[
{ "frame_num": "4","width": "1920","height":"1080","other_info": "some_info" },
{ "frame_num": "6","width": "1920","height":"1080","other_info": "some_info" },
{ "frame_num": "8","width": "1920","height":"1080","other_info": "some_info" },
{ "frame_num": "10","width": "1920","height":"1080","other_info": "some_info" },
]
one possible way could be with the help of list comprehension. But I want an efficient way of doing it since this list could have millions of frame info I wish to get some pythonic way of doing this.