pprint Python Module

pprint function from pprint Python Module can be used to print stuff to console, like print function. But for printing out non pythonic data types pprint just makes output a little bit readable.

Python Code Showing use of pprint

# Python Code showing use of pprint Module

# Importing pprint module
import pprint

# Some weird data
data = (
	"This is ComputerScienceHub.io", ["Computer Science", "Programming", "Machine Learning"],
	("We have a lot of computer science experts")
	)

# Prints out weird data beautifully
pprint.pprint(data)

Output of Above Code

('This is ComputerScienceHub.io',
 ['Computer Science', 'Programming', 'Machine Learning'],
 'We have a lot of computer science experts')

pprint function just makes stuff more readable, specifically this can be used to examine data returned by some API. As usually, most of APIs return data in some weird form.
I hope that you found this article useful, similar to this I’ve put together a number of other articles about Python Programming Language. You can check those out here => Python Programming Language Computer Science Hub.

Gagan

Hi, there I'm founder of ComputerScienceHub(Started this to bring useful Computer Science information just at one place). Personally I've been doing JavaScript, Python development since 2015(Been long) - Worked upon couple of Web Development Projects, Did some Data Science stuff using Python. Nowadays primarily I work as Freelance JavaScript Developer(Web Developer) and on side-by-side managing team of Computer Science specialists at ComputerScienceHub.io

Leave a Reply

Your email address will not be published. Required fields are marked *

Recent Posts