How do you select python Tuple/Dictionary values where the index is greater than some number. I would think the code should look similar to the following assuming we create a Tuple:
dt = (100, 200, 300,400) dt[dt.index > 1]
You could just slice the tuple.
>>> dt = (100, 200, 300,400)
>>> dt[2:]
(300, 400)
You have to use : instead of > in tuples. like the answer ahsanul haque provided. thumbs up for him.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.