What is the difference between print and pprint in Python?

0 votes
I am beginner in Python. I want to know the difference between print and pprint in Python. Any help would be appreciated
Jul 8 in Python by Neel
• 2,450 points
40 views

1 answer to this question.

0 votes

As per the documentation, 

The pprint module provides a capability to “pretty-print” arbitrary Python data structures in a form that can be used as input to the interpreter. If the formatted structures include objects which are not fundamental Python types, the representation may not be loadable. This may be the case if objects such as files, sockets, classes, or instances are included, as well as many other built-in objects which are not representable as Python constants.

The print() function prints the given object to the standard output device (screen) or to the text stream file.

The full syntax of print() is:

print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False)

answered Jul 8 by Arvind
• 2,520 points

Related Questions In Python

0 votes
0 answers

What is the difference between print and return in python?

If we get the same output why ...READ MORE

May 23 in Python by Waseem
• 4,160 points

edited May 24 by Omkar 37 views
+1 vote
1 answer

What is the difference between range and xrange functions in Python 2.X?

xrange only stores the range params and ...READ MORE

answered Aug 22, 2018 in Python by Priyaj
• 56,200 points
170 views
0 votes
0 answers

What is the difference between isdigit, isnumeric and isdecimal in python?

Can you give examples for each of ...READ MORE

May 31 in Python by Waseem
• 4,160 points
63 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 168 views
+4 votes
6 answers
0 votes
1 answer

What is the difference between str() and repr() functions in Python?

str() is mostly used to create output ...READ MORE

answered Jul 8 in Python by Arvind
• 2,520 points
50 views
0 votes
1 answer

What is the use of '==' operator in dictionary in Python?

Yes you can use '==' operator to ...READ MORE

answered Jul 24 in Python by Arvind
• 2,520 points
14 views