Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b328ba1

Browse files
[3.12] Fix indentation in json.AttrDict REPL example (GH-104930) (#104931)
Fix indentation in `json.AttrDict` REPL example (GH-104930) This is causing the docs to be rendered incorrectly. (cherry picked from commit 38539ef) Co-authored-by: Alex Waygood <[email protected]>
1 parent 1a47d11 commit b328ba1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Doc/library/json.rst

+8-8
Original file line numberDiff line numberDiff line change
@@ -559,14 +559,14 @@ Exceptions
559559

560560
.. doctest::
561561

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'])
570570

571571
Attribute style access only works for keys that are valid attribute
572572
names. In contrast, dictionary style access works for all keys. For

0 commit comments

Comments
 (0)