Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
x = [
	'a',
	'b',
	{
		'foo': 1,
		'bar':
		{
			'x' : 10,
			'y' : 20,
			'z' : 30
		},
		'baz': 3
	},
	'c',
	'd'
]

print(x[2]['bar']['z'])

Result

Code Block
30


Delete a dictionary element

Deleting a dictionary element by statement

Code Block
del d['foo']

Deleting a dictionary element by method

Code Block
d.pop('foo')

...