Python short course: Nesting in Python

 Nesting in Python operates like below

 


In [1]: nest_example = {'name': {'first': 'Bob', 'second': 'Smith'}, 'jobs': ['dev', 'mgr'
   ...: ], 'age': 40.5}

In [2]: nest_example['name']
Out[2]: {'first': 'Bob', 'second': 'Smith'}

In [3]: nest_example['name']['first']
Out[3]: 'Bob'

In [4]: nest_example['jobs'][0]
Out[4]: 'dev'

Comments

Popular posts from this blog

Lab's weekly topic - week 50 2023 - Detailed explanation for encoder of U-Net

Lab's weekly topic - week 49, 2023 - What's limitations and possible solutions for a new AI tools to detect blood poisoning?

Lab's recommendation: Awesome books to learn machine learning and AI (continue updating)