On 3/26/2012 7:45 AM, redstone-c...@163.com wrote:
I know the print statement produces the same result when both of
these two instructions are executed ,I just want to know Is there any
difference between print 3 and print '3' in Python ?
If you want to see the difference between the number and string
representation thereof, use repr(x).
>>> print(repr(3), repr('3'), [3, '3'])
3 '3' [3, '3']
Note that printing a collection prints the repr() of each item precisely
so one can tell the difference between the item being a number or a string.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list