File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -559,14 +559,14 @@ Exceptions
559
559
560
560
.. doctest ::
561
561
562
- >>> json_string = ' {"mercury": 88, "venus": 225, "earth": 365, "mars": 687}'
563
- >>> orbital_period = json.loads(json_string, object_hook = AttrDict)
564
- >>> orbital_period[' earth' ] # Dict style lookup
565
- 365
566
- >>> orbital_period.earth # Attribute style lookup
567
- 365
568
- >>> orbital_period.keys() # All dict methods are present
569
- dict_keys(['mercury', 'venus', 'earth', 'mars'])
562
+ >>> json_string = ' {"mercury": 88, "venus": 225, "earth": 365, "mars": 687}'
563
+ >>> orbital_period = json.loads(json_string, object_hook = AttrDict)
564
+ >>> orbital_period[' earth' ] # Dict style lookup
565
+ 365
566
+ >>> orbital_period.earth # Attribute style lookup
567
+ 365
568
+ >>> orbital_period.keys() # All dict methods are present
569
+ dict_keys(['mercury', 'venus', 'earth', 'mars'])
570
570
571
571
Attribute style access only works for keys that are valid attribute
572
572
names. In contrast, dictionary style access works for all keys. For
You can’t perform that action at this time.
0 commit comments