Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
6a21f552
Commit
6a21f552
authored
May 29, 2011
by
Éric Araujo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don’t misuse “package data” in pprint example
parent
456ae893
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
Doc/library/pprint.rst
Doc/library/pprint.rst
+3
-3
No files found.
Doc/library/pprint.rst
View file @
6a21f552
...
@@ -192,7 +192,7 @@ Example
...
@@ -192,7 +192,7 @@ Example
-------
-------
To demonstrate several uses of the :func:`pprint` function and its parameters,
To demonstrate several uses of the :func:`pprint` function and its parameters,
let's fetch information about a p
ackage
from PyPI::
let's fetch information about a p
roject
from PyPI::
>>> import json
>>> import json
>>> import pprint
>>> import pprint
...
@@ -200,8 +200,8 @@ let's fetch information about a package from PyPI::
...
@@ -200,8 +200,8 @@ let's fetch information about a package from PyPI::
>>> with urlopen('http://pypi.python.org/pypi/configparser/json') as url:
>>> with urlopen('http://pypi.python.org/pypi/configparser/json') as url:
... http_info = url.info()
... http_info = url.info()
... raw_data = url.read().decode(http_info.get_content_charset())
... raw_data = url.read().decode(http_info.get_content_charset())
>>> p
ackage_data
= json.loads(raw_data)
>>> p
roject_info
= json.loads(raw_data)
>>> result = {'headers': http_info.items(), 'body': p
ackage_data
}
>>> result = {'headers': http_info.items(), 'body': p
roject_info
}
In its basic form, :func:`pprint` shows the whole object::
In its basic form, :func:`pprint` shows the whole object::
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment