FAQ: __str__ vs __repr__

Sébastien Boisgérault Sebastien.Boisgerault at gmail.com
Wed Jun 15 09:08:47 EDT 2005


Errata:

    >>> str(0.1)
    '0.1'
    >>> str("it's a bad idea")
    "it's a bad idea"

    >>> repr(0.1)
   ' 0.10000000000000001'
    >>> repr("it's a bad idea")
   '"it\'s a bad idea"' 


SB




More information about the Python-list mailing list