summaryrefslogtreecommitdiffstats
path: root/Doc/library/json.rst
diff options
context:
space:
mode:
authorAlex Waygood <Alex.Waygood@Gmail.com>2023-05-25 13:05:43 (GMT)
committerGitHub <noreply@github.com>2023-05-25 13:05:43 (GMT)
commit38539ef1267f26a8b3508fcc8c6199cf46fc300b (patch)
tree29410233c900c19b583bdc74128f58ff791483ea /Doc/library/json.rst
parent1080c4386dd3beb9ee808acdf3c3f01835f73860 (diff)
downloadcpython-38539ef1267f26a8b3508fcc8c6199cf46fc300b.zip
cpython-38539ef1267f26a8b3508fcc8c6199cf46fc300b.tar.gz
cpython-38539ef1267f26a8b3508fcc8c6199cf46fc300b.tar.bz2
Fix indentation in `json.AttrDict` REPL example (#104930)
This is causing the docs to be rendered incorrectly.
Diffstat (limited to 'Doc/library/json.rst')
-rw-r--r--Doc/library/json.rst16
1 files changed, 8 insertions, 8 deletions
diff --git a/Doc/library/json.rst b/Doc/library/json.rst
index a752efd..ef58dd0 100644
--- a/Doc/library/json.rst
+++ b/Doc/library/json.rst
@@ -559,14 +559,14 @@ Exceptions
.. doctest::
- >>> json_string = '{"mercury": 88, "venus": 225, "earth": 365, "mars": 687}'
- >>> orbital_period = json.loads(json_string, object_hook=AttrDict)
- >>> orbital_period['earth'] # Dict style lookup
- 365
- >>> orbital_period.earth # Attribute style lookup
- 365
- >>> orbital_period.keys() # All dict methods are present
- dict_keys(['mercury', 'venus', 'earth', 'mars'])
+ >>> json_string = '{"mercury": 88, "venus": 225, "earth": 365, "mars": 687}'
+ >>> orbital_period = json.loads(json_string, object_hook=AttrDict)
+ >>> orbital_period['earth'] # Dict style lookup
+ 365
+ >>> orbital_period.earth # Attribute style lookup
+ 365
+ >>> orbital_period.keys() # All dict methods are present
+ dict_keys(['mercury', 'venus', 'earth', 'mars'])
Attribute style access only works for keys that are valid attribute
names. In contrast, dictionary style access works for all keys. For