Why is it different from the example on the tutorial?

Mark Lawrence breamoreboy at yahoo.co.uk
Sun Jul 6 10:47:25 EDT 2014


On 06/07/2014 15:34, Roy Smith wrote:
>
> * You can print foo itself, to find out its value, but this can get
> tricky, since sometimes objects print themselves in confusing ways.
> Printing repr(foo) will usually get you more detail.
>

For the OP the pretty print module is usually better than plain old 
print https://docs.python.org/3/library/pprint.html#module-pprint.

I use it like this

from pprint import pprint as pp

The iPython shell (and presumably others as well) also does a better job 
of displaying objects than print.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com





More information about the Python-list mailing list