Explanation for trailing comma in example from Learning Python?
Steve Holden
steve at holdenweb.com
Thu Feb 19 16:08:37 EST 2009
alex goretoy wrote:
> Thank you for clerification Christian,
> when using trailing comma with print statement/function, does it not
> mean to output newline after printed data?
>
It does (in Python before 3.0) - but that has nothing to do with the
original question. You will find you get quite different results for
print 1, # print integer 1 followed by no newline
and
print (1, ) # print the one-element tuple whose element
# is the integer 1, followed by a newline.
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
More information about the Python-list
mailing list