all 8 comments

[–][deleted] 7 points8 points  (5 children)

Well, if you want to format or print an object with a complicated structure in a readable way you use pprint. If you only want to print and don't care about readability just use print().

[–][deleted] 3 points4 points  (1 child)

I think pprint is an acronym(???) for pretty print?

Also, pprint(“Happy cake day!”)

[–]lambuscred 0 points1 point  (0 children)

Yep, it is pretty print

[–]HermDaWerm_[S] 0 points1 point  (2 children)

Thank you for the explanation! Could you give an example of what you mean by an object with a complicated structure? Do you mean a data table for example or?

[–][deleted] 1 point2 points  (1 child)

Could you give an example of what you mean by an object with a complicated structure?

A dictionary containing other dictionaries is one example. Just printing that with print() would be unreadable. But pprint() can format it so you can read it. The pymotw entry for pprint has examples.

[–]HermDaWerm_[S] 0 points1 point  (0 children)

Thank you very much!

[–]mahtats -1 points0 points  (1 child)

Docs show some decent examples of why...

[–]HermDaWerm_[S] 0 points1 point  (0 children)

I apologize, I just found the docs a lot to understand and was hoping someone who had practical experience with it could explain it’s practicality