Skip to content

Get printable representation of an object in Python

repr() returns a string that holds a printable representation of an object

Advertisements

Examples

a = [1,2,3]
b = 'just a string'
c = 55

print str(a)
print repr(a)

print str(b)
print repr(b)

print str(c)
print repr(c)

Source: GitHub

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.