'Does anyone see this expression to get data in python?
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?
Solution 1:[1]
Since tuples are hashable, they can be used as dict keys. That includes the empty tuple:
d = {
(): 'a'
}
print(d[()])
This outputs:
a
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | DeepSpace |
