Pretty-Printed Debugging

Python’s Debugger pdb has a nice built-in command pp to pretty-print values.

(Pdb) import requests
(Pdb) resp = requests.get('https://api.github.com/events')
(Pdb) p resp.json()[0]
{'id': '21610187097', 'type': 'ForkEvent', 'actor': {'id': 59905114, 'login': 'xun911', 'display_login': 'xun911', 'gravatar_id': '', 'url': 'https://api.github.com/users/xun911', 'avatar_url': 'https://avatars.githubusercontent.com/u/59905114?'}, 'repo': {'id': 308571205, 'name': 'Yukiyousa/Tensorflow2.3.0-GAN', 'url': 'https://api.github.com/repos/Yukiyousa/Tensorflow2.3.0-GAN'}, 'payload': {'forkee': {'id': 488523688, 'node_id': 'R_kgDOHR5HqA', 'name': 'Tensorflow2.3.0-GAN', 'full_name': 'xun911/Tensorflow2.3.0-GAN', 'private': False, 'owner': {'login': 'xun911', 'id': 59905114, 'node_id': 'MDQ6VXNlcjU5OTA1MTE0', 'avatar_url': 'https://avatars.githubusercontent.com/u/59905114?v=4', 'gravatar_id': '', 'url': 'https://api.github.com/users/xun911', 'html_url': 'https://github.com/xun911', 'followers_url': 'https://api.github.com/users/xun911/followers', 'following_url': 'https://api.github.com/users/xun911/following{/other_user}', 'gists_url': 'https://api.github.com/users/xun911/gists{/gist_id}', 'starred_url': 'https://api.github.com/users/xun911/starred{/owner}{/repo}', 'subscriptions_url': 'https://api.github.com/users/xun911/subscriptions', 'organizations_url': 'https://api.github.com/users/xun911/orgs', 'repos_url': 'https://api.github.com/users/xun911/repos', 'events_url': 'https://api.github.com/users/xun911/events{/privacy}', 'received_events_url': 'https://api.github.com/users/xun911/received_events', 'type': 'User', 'site_admin': False}, 'html_url': 'https://github.com/xun911/Tensorflow2.3.0-GAN', 'description': '本项目为简单的GAN实践,在MNIST数据集上使用GAN生成手写数字图片', 'fork': True, 'url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN', 'forks_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/forks', 'keys_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/keys{/key_id}', 'collaborators_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/collaborators{/collaborator}', 'teams_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/teams', 'hooks_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/hooks', 'issue_events_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/issues/events{/number}', 'events_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/events', 'assignees_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/assignees{/user}', 'branches_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/branches{/branch}', 'tags_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/tags', 'blobs_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/git/blobs{/sha}', 'git_tags_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/git/tags{/sha}', 'git_refs_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/git/refs{/sha}', 'trees_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/git/trees{/sha}', 'statuses_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/statuses/{sha}', 'languages_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/languages', 'stargazers_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/stargazers', 'contributors_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/contributors', 'subscribers_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/subscribers', 'subscription_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/subscription', 'commits_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/commits{/sha}', 'git_commits_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/git/commits{/sha}', 'comments_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/comments{/number}', 'issue_comment_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/issues/comments{/number}', 'contents_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/contents/{+path}', 'compare_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/compare/{base}...{head}', 'merges_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/merges', 'archive_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/{archive_format}{/ref}', 'downloads_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/downloads', 'issues_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/issues{/number}', 'pulls_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/pulls{/number}', 'milestones_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/milestones{/number}', 'notifications_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/notifications{?since,all,participating}', 'labels_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/labels{/name}', 'releases_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/releases{/id}', 'deployments_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/deployments', 'created_at': '2022-05-04T09:17:55Z', 'updated_at': '2021-09-06T06:44:01Z', 'pushed_at': '2020-10-30T08:44:58Z', 'git_url': 'git://github.com/xun911/Tensorflow2.3.0-GAN.git', 'ssh_url': 'git@github.com:xun911/Tensorflow2.3.0-GAN.git', 'clone_url': 'https://github.com/xun911/Tensorflow2.3.0-GAN.git', 'svn_url': 'https://github.com/xun911/Tensorflow2.3.0-GAN', 'homepage': '', 'size': 4, 'stargazers_count': 0, 'watchers_count': 0, 'language': None, 'has_issues': False, 'has_projects': True, 'has_downloads': True, 'has_wiki': True, 'has_pages': False, 'forks_count': 0, 'mirror_url': None, 'archived': False, 'disabled': False, 'open_issues_count': 0, 'license': None, 'allow_forking': True, 'is_template': False, 'topics': [], 'visibility': 'public', 'forks': 0, 'open_issues': 0, 'watchers': 0, 'default_branch': 'main', 'public': True}}, 'public': True, 'created_at': '2022-05-04T09:17:56Z'}
(Pdb) pp resp.json()[0]
{'actor': {'avatar_url': 'https://avatars.githubusercontent.com/u/59905114?',
           'display_login': 'xun911',
           'gravatar_id': '',
           'id': 59905114,
           'login': 'xun911',
           'url': 'https://api.github.com/users/xun911'},
 'created_at': '2022-05-04T09:17:56Z',
 'id': '21610187097',
 'payload': {'forkee': {'allow_forking': True,
                        'archive_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/{archive_format}{/ref}',
                        'archived': False,
                        'assignees_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/assignees{/user}',
                        'blobs_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/git/blobs{/sha}',
                        'branches_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/branches{/branch}',
                        'clone_url': 'https://github.com/xun911/Tensorflow2.3.0-GAN.git',
                        'collaborators_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/collaborators{/collaborator}',
                        'comments_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/comments{/number}',
                        'commits_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/commits{/sha}',
                        'compare_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/compare/{base}...{head}',
                        'contents_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/contents/{+path}',
                        'contributors_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/contributors',
                        'created_at': '2022-05-04T09:17:55Z',
                        'default_branch': 'main',
                        'deployments_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/deployments',
                        'description': '本项目为简单的GAN实践,在MNIST数据集上使用GAN生成手写数字图片',
                        'disabled': False,
                        'downloads_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/downloads',
                        'events_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/events',
                        'fork': True,
                        'forks': 0,
                        'forks_count': 0,
                        'forks_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/forks',
                        'full_name': 'xun911/Tensorflow2.3.0-GAN',
                        'git_commits_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/git/commits{/sha}',
                        'git_refs_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/git/refs{/sha}',
                        'git_tags_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/git/tags{/sha}',
                        'git_url': 'git://github.com/xun911/Tensorflow2.3.0-GAN.git',
                        'has_downloads': True,
                        'has_issues': False,
                        'has_pages': False,
                        'has_projects': True,
                        'has_wiki': True,
                        'homepage': '',
                        'hooks_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/hooks',
                        'html_url': 'https://github.com/xun911/Tensorflow2.3.0-GAN',
                        'id': 488523688,
                        'is_template': False,
                        'issue_comment_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/issues/comments{/number}',
                        'issue_events_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/issues/events{/number}',
                        'issues_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/issues{/number}',
                        'keys_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/keys{/key_id}',
                        'labels_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/labels{/name}',
                        'language': None,
                        'languages_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/languages',
                        'license': None,
                        'merges_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/merges',
                        'milestones_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/milestones{/number}',
                        'mirror_url': None,
                        'name': 'Tensorflow2.3.0-GAN',
                        'node_id': 'R_kgDOHR5HqA',
                        'notifications_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/notifications{?since,all,participating}',
                        'open_issues': 0,
                        'open_issues_count': 0,
                        'owner': {'avatar_url': 'https://avatars.githubusercontent.com/u/59905114?v=4',
                                  'events_url': 'https://api.github.com/users/xun911/events{/privacy}',
                                  'followers_url': 'https://api.github.com/users/xun911/followers',
                                  'following_url': 'https://api.github.com/users/xun911/following{/other_user}',
                                  'gists_url': 'https://api.github.com/users/xun911/gists{/gist_id}',
                                  'gravatar_id': '',
                                  'html_url': 'https://github.com/xun911',
                                  'id': 59905114,
                                  'login': 'xun911',
                                  'node_id': 'MDQ6VXNlcjU5OTA1MTE0',
                                  'organizations_url': 'https://api.github.com/users/xun911/orgs',
                                  'received_events_url': 'https://api.github.com/users/xun911/received_events',
                                  'repos_url': 'https://api.github.com/users/xun911/repos',
                                  'site_admin': False,
                                  'starred_url': 'https://api.github.com/users/xun911/starred{/owner}{/repo}',
                                  'subscriptions_url': 'https://api.github.com/users/xun911/subscriptions',
                                  'type': 'User',
                                  'url': 'https://api.github.com/users/xun911'},
                        'private': False,
                        'public': True,
                        'pulls_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/pulls{/number}',
                        'pushed_at': '2020-10-30T08:44:58Z',
                        'releases_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/releases{/id}',
                        'size': 4,
                        'ssh_url': 'git@github.com:xun911/Tensorflow2.3.0-GAN.git',
                        'stargazers_count': 0,
                        'stargazers_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/stargazers',
                        'statuses_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/statuses/{sha}',
                        'subscribers_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/subscribers',
                        'subscription_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/subscription',
                        'svn_url': 'https://github.com/xun911/Tensorflow2.3.0-GAN',
                        'tags_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/tags',
                        'teams_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/teams',
                        'topics': [],
                        'trees_url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN/git/trees{/sha}',
                        'updated_at': '2021-09-06T06:44:01Z',
                        'url': 'https://api.github.com/repos/xun911/Tensorflow2.3.0-GAN',
                        'visibility': 'public',
                        'watchers': 0,
                        'watchers_count': 0}},
 'public': True,
 'repo': {'id': 308571205,
          'name': 'Yukiyousa/Tensorflow2.3.0-GAN',
          'url': 'https://api.github.com/repos/Yukiyousa/Tensorflow2.3.0-GAN'},
 'type': 'ForkEvent'}

blogroll

social