Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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 :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Since tuples are hashable, they can be used as dict keys. That includes the empty tuple:

d = {
    (): 'a'
}

print(d[()])

This outputs:

a
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading