Is there any difference between print 3 and print '3' in Python ?
Ian Foote
ian at feete.org
Sun Sep 9 10:41:46 EDT 2012
On 09/09/12 14:23, iMath wrote:
> 在 2012年3月26日星期一UTC+8下午7时45分26秒,iMath写道:
>> 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 ?
> thx everyone
The difference is that 3 is an integer whereas '3' is a string. The
print statement (function in python 3) converts any object to a string
before displaying it on the screen, so print 3 and print '3' both
display the same result.
Ian F
More information about the Python-list
mailing list