nums_frames = dataset['n_frames'][()]
Here use [()]
to get the data. i don't understand, i haven't seen this kind of usage in python before.
if anyone knows that, could you please explain the usage and scenerio?
CodePudding user response:
Since tuples are hashable, they can be used as dict keys. That includes the empty tuple:
d = {
(): 'a'
}
print(d[()])
This outputs:
a