{"id":21227,"date":"2021-10-20T17:03:44","date_gmt":"2021-10-20T11:33:44","guid":{"rendered":"https:\/\/tutorial.eyehunts.com\/?p=21227"},"modified":"2022-12-05T18:47:45","modified_gmt":"2022-12-05T13:17:45","slug":"python-pprint-module-method-example-code","status":"publish","type":"post","link":"https:\/\/tutorial.eyehunts.com\/python\/python-pprint-module-method-example-code\/","title":{"rendered":"Python pprint module method | Example code"},"content":{"rendered":"\n<p>Python<strong> pprint() Method<\/strong> formatted and more readable way <a href=\"https:\/\/tutorial.eyehunts.com\/js\/javascript-print-console-object-div-page-button\/\">console <\/a>output. You will get it in a neat, and presentable fashion compares to using the <a href=\"https:\/\/tutorial.eyehunts.com\/python\/python-print-function-hello-world\/\">print() function<\/a>.<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p><strong>Syntax of pprint method<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pprint.pprint(object, stream=None, indent=1, width=80, depth=None, stream=None, *, compact=False, sort_dicts=True)<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><u>indent<\/u>:<\/strong> The amount of indent when there are multiple lines<\/li>\n\n\n\n<li><strong><u>width<\/u>:<\/strong> The amount of width between two data objects<\/li>\n\n\n\n<li><strong><u>depth<\/u>:<\/strong> The number of levels which need to be printed<\/li>\n\n\n\n<li><strong><u>stream<\/u>:<\/strong> An output stream (where the data is displayed) can be set-up<\/li>\n\n\n\n<li><strong><u>compact<\/u>:<\/strong> It helps fit as many objects as possible within every line&#8217;s width<\/li>\n<\/ul>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Python pprint method example<\/strong><\/h2>\n\n\n\n<p>Simple example code print data objects in a pretty format, more readable, and well-formatted (pprint itself means <strong>pretty print<\/strong>).<\/p>\n\n\n\n<p>The <strong>pprint<\/strong> module provides a capability to \u201cpretty-print\u201d arbitrarily, you have to <a href=\"https:\/\/tutorial.eyehunts.com\/python\/python-import-module-from-path-example-code\/\">import <\/a>this <a href=\"https:\/\/tutorial.eyehunts.com\/python\/python-module-variables-example-code\/\">module<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import pprint\n\nmy_dict = {1: 'a', 2: 'b', 3: 'z', 4: 'm', \"Code\": 'Python'}\n\npprint.pprint(my_dict, indent=1, width=40, depth=5)\n<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong>: <\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"275\" height=\"228\" src=\"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/10\/Python-pprint-module-method.jpg?resize=275%2C228&#038;ssl=1\" alt=\"Python pprint module method\" class=\"wp-image-21357\"\/><\/figure><\/div>\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p><strong>Another example<\/strong><\/p>\n\n\n\n<p>Get data from API and show output using <strong>pprint<\/strong>() method. Response is in a JSON format.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import json\nimport requests\nfrom pprint import pprint\n\nres = requests.get(\"https:\/\/reqres.in\/api\/products\/3\")\ndata = json.loads(res.text)\n\n# printing json response\npprint(data)\n<\/code><\/pre>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Do comment if you have any doubts or suggestions so this Python print topic.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Note:<\/strong> IDE:&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/www.jetbrains.com\/pycharm\/\" target=\"_blank\">PyCharm<\/a>&nbsp;2021.3.3 (Community Edition)<\/p><p>Windows 10<\/p><p><strong>Python 3.10.1<\/strong><\/p><p>All<strong>&nbsp;Python Examples&nbsp;are in&nbsp;Python&nbsp;3<\/strong>, so Maybe its different from python 2 or upgraded versions.<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Python pprint() Method formatted and more readable way console output. You will get it in a neat, and presentable fashion compares to using the print() function. Syntax of pprint method Python pprint method example Simple example code print data objects in a pretty format, more readable, and well-formatted (pprint itself means pretty print). The pprint&hellip;&nbsp;<a href=\"https:\/\/tutorial.eyehunts.com\/python\/python-pprint-module-method-example-code\/\" rel=\"bookmark\">Read More &raquo;<span class=\"screen-reader-text\">Python pprint module method | Example code<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[30],"tags":[163],"post_series":[],"class_list":["post-21227","post","type-post","status-publish","format-standard","hentry","category-python","tag-python-print"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.1.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python pprint module method | Code<\/title>\n<meta name=\"description\" content=\"Python pprint() Method formatted and more readable way console output. You will get it in a neat, and presentable fashion compare to using\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/tutorial.eyehunts.com\/python\/python-pprint-module-method-example-code\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python pprint module method | Code\" \/>\n<meta property=\"og:description\" content=\"Python pprint() Method formatted and more readable way console output. You will get it in a neat, and presentable fashion compare to using\" \/>\n<meta property=\"og:url\" content=\"https:\/\/tutorial.eyehunts.com\/python\/python-pprint-module-method-example-code\/\" \/>\n<meta property=\"og:site_name\" content=\"Tutorial\" \/>\n<meta property=\"article:published_time\" content=\"2021-10-20T11:33:44+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-12-05T13:17:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/10\/Python-pprint-module-method.jpg\" \/>\n<meta name=\"author\" content=\"Rohit\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rohit\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-pprint-module-method-example-code\/\",\"url\":\"https:\/\/tutorial.eyehunts.com\/python\/python-pprint-module-method-example-code\/\",\"name\":\"Python pprint module method | Code\",\"isPartOf\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-pprint-module-method-example-code\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-pprint-module-method-example-code\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/10\/Python-pprint-module-method.jpg\",\"datePublished\":\"2021-10-20T11:33:44+00:00\",\"dateModified\":\"2022-12-05T13:17:45+00:00\",\"author\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1\"},\"description\":\"Python pprint() Method formatted and more readable way console output. You will get it in a neat, and presentable fashion compare to using\",\"breadcrumb\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-pprint-module-method-example-code\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/tutorial.eyehunts.com\/python\/python-pprint-module-method-example-code\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-pprint-module-method-example-code\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/10\/Python-pprint-module-method.jpg?fit=275%2C228&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/10\/Python-pprint-module-method.jpg?fit=275%2C228&ssl=1\",\"width\":275,\"height\":228},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-pprint-module-method-example-code\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/tutorial.eyehunts.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python pprint module method | Example code\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/#website\",\"url\":\"https:\/\/tutorial.eyehunts.com\/\",\"name\":\"Tutorial\",\"description\":\"By EyeHunts\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/tutorial.eyehunts.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1\",\"name\":\"Rohit\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777979855\",\"contentUrl\":\"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777979855\",\"caption\":\"Rohit\"},\"description\":\"Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology &amp; like learning technical.\",\"url\":\"https:\/\/tutorial.eyehunts.com\/author\/rohit\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python pprint module method | Code","description":"Python pprint() Method formatted and more readable way console output. You will get it in a neat, and presentable fashion compare to using","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/tutorial.eyehunts.com\/python\/python-pprint-module-method-example-code\/","og_locale":"en_US","og_type":"article","og_title":"Python pprint module method | Code","og_description":"Python pprint() Method formatted and more readable way console output. You will get it in a neat, and presentable fashion compare to using","og_url":"https:\/\/tutorial.eyehunts.com\/python\/python-pprint-module-method-example-code\/","og_site_name":"Tutorial","article_published_time":"2021-10-20T11:33:44+00:00","article_modified_time":"2022-12-05T13:17:45+00:00","og_image":[{"url":"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/10\/Python-pprint-module-method.jpg","type":"","width":"","height":""}],"author":"Rohit","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Rohit","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/tutorial.eyehunts.com\/python\/python-pprint-module-method-example-code\/","url":"https:\/\/tutorial.eyehunts.com\/python\/python-pprint-module-method-example-code\/","name":"Python pprint module method | Code","isPartOf":{"@id":"https:\/\/tutorial.eyehunts.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/tutorial.eyehunts.com\/python\/python-pprint-module-method-example-code\/#primaryimage"},"image":{"@id":"https:\/\/tutorial.eyehunts.com\/python\/python-pprint-module-method-example-code\/#primaryimage"},"thumbnailUrl":"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/10\/Python-pprint-module-method.jpg","datePublished":"2021-10-20T11:33:44+00:00","dateModified":"2022-12-05T13:17:45+00:00","author":{"@id":"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1"},"description":"Python pprint() Method formatted and more readable way console output. You will get it in a neat, and presentable fashion compare to using","breadcrumb":{"@id":"https:\/\/tutorial.eyehunts.com\/python\/python-pprint-module-method-example-code\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/tutorial.eyehunts.com\/python\/python-pprint-module-method-example-code\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tutorial.eyehunts.com\/python\/python-pprint-module-method-example-code\/#primaryimage","url":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/10\/Python-pprint-module-method.jpg?fit=275%2C228&ssl=1","contentUrl":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/10\/Python-pprint-module-method.jpg?fit=275%2C228&ssl=1","width":275,"height":228},{"@type":"BreadcrumbList","@id":"https:\/\/tutorial.eyehunts.com\/python\/python-pprint-module-method-example-code\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/tutorial.eyehunts.com\/"},{"@type":"ListItem","position":2,"name":"Python pprint module method | Example code"}]},{"@type":"WebSite","@id":"https:\/\/tutorial.eyehunts.com\/#website","url":"https:\/\/tutorial.eyehunts.com\/","name":"Tutorial","description":"By EyeHunts","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/tutorial.eyehunts.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1","name":"Rohit","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/image\/","url":"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777979855","contentUrl":"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777979855","caption":"Rohit"},"description":"Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology &amp; like learning technical.","url":"https:\/\/tutorial.eyehunts.com\/author\/rohit\/"}]}},"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":21167,"url":"https:\/\/tutorial.eyehunts.com\/python\/python-print-object-attributes-example-code\/","url_meta":{"origin":21227,"position":0},"title":"Python print object attributes | Example code","author":"Rohit","date":"October 18, 2021","format":false,"excerpt":"Use the dir() or vars() inspect module to get object attributes and then print it using the print() method. Python print object attributes example Simple example code. Using the dir() Function in Python Call dir() function without arguments, returns the list of the names in the current local scope, and\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/10\/Python-print-object-attributes.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":21212,"url":"https:\/\/tutorial.eyehunts.com\/python\/list-attributes-python-basics\/","url_meta":{"origin":21227,"position":1},"title":"List attributes Python | Basics","author":"Rohit","date":"October 18, 2021","format":false,"excerpt":"The list has many attributes and methods that you can use. Here are attributes of the list in Python: list.append(x) # append x to end of list list.extend(iterable) # append all elements of iterable to list list.insert(i, x) # insert x at index i list.remove(x) # remove first occurance of\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/10\/List-attributes-Python.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/10\/List-attributes-Python.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/10\/List-attributes-Python.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/10\/List-attributes-Python.jpg?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":35442,"url":"https:\/\/tutorial.eyehunts.com\/python\/python-write-json-to-file-pretty\/","url_meta":{"origin":21227,"position":2},"title":"Python write JSON to file pretty","author":"Rohit","date":"January 26, 2023","format":false,"excerpt":"Use the optional argument indent in the dumps() function to write JSON to file pretty in Python. The json.dump() method provides the following parameters to pretty-print JSON data. json.dumps(mydata, indent=4) The indent parameter specifies the spaces used at the beginning of a line. Python writes JSON to files pretty example\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2023\/01\/Python-write-JSON-to-file-pretty.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2023\/01\/Python-write-JSON-to-file-pretty.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2023\/01\/Python-write-JSON-to-file-pretty.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2023\/01\/Python-write-JSON-to-file-pretty.jpg?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":21374,"url":"https:\/\/tutorial.eyehunts.com\/python\/python-json-dumps-indent-example\/","url_meta":{"origin":21227,"position":3},"title":"Python JSON dumps indent | Example","author":"Rohit","date":"October 21, 2021","format":false,"excerpt":"Python JSON method used indent parameters to specify the spaces that are used at the beginning of a line. If the indent parameter is not used By default it doesn't use indentations and writes all data on a single line, which is not readable. Example use JSON dumps indent in\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/10\/Python-JSON-dumps-indent.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":21333,"url":"https:\/\/tutorial.eyehunts.com\/python\/python-print-json-pretty-example-code\/","url_meta":{"origin":21227,"position":4},"title":"Python print JSON pretty | Example code","author":"Rohit","date":"October 21, 2021","format":false,"excerpt":"Use JSON dump() method with indent parameter to print JSON pretty in Python. You should use the optional argument indent. print(json.dumps(dict, indent=4)) Python pretty print JSON example Simple example code Python's built-in JSON module can handle that for you: import json data = '[{\"ID\":101,\"Name\":\"John\",\"Role\":\"Member\"},' \\ '{\"ID\":102,\"Name\":\"Kenny\",\"Role\":\"Editor\"}]' res = json.loads(data) json_str\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2022\/12\/Python-pretty-print-JSON-example.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":21323,"url":"https:\/\/tutorial.eyehunts.com\/python\/python-pretty-print-json-example-code\/","url_meta":{"origin":21227,"position":5},"title":"Python pretty print JSON | Example code","author":"Rohit","date":"October 21, 2021","format":false,"excerpt":"Pretty printing means having proper line breaks, indentation, white space, and overall structure. Use json.dumps() to pretty print out the JSON in a more structured format in Python. Using the Indent keyword while dumping the data decides what level spaces the user wants. json.dumps(json_object, indent = 1) Example Python pretty\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/10\/Python-pretty-print-JSON.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts\/21227","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/comments?post=21227"}],"version-history":[{"count":1,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts\/21227\/revisions"}],"predecessor-version":[{"id":34679,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts\/21227\/revisions\/34679"}],"wp:attachment":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/media?parent=21227"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/categories?post=21227"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/tags?post=21227"},{"taxonomy":"post_series","embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/post_series?post=21227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}