print repr code example

Example 1: what is repr function in python

#The repr() function returns a printable representation of the given object.
Upvote = "Do make an upvote click on the top right corner button."
>>> print(Upvote)
>>> 'Do make an upvote click on the top right corner button.'

>>> print(repr(Upvote))
>>>"'Do make an upvote click on the top right corner button.'"

Example 2: python repr

# The repr() function returns a printable representational string of the given object.
>>> var = 'foo'
>>> print(repr(var))
"'foo'"

Tags:

Misc Example