print function question

Eric Bishop rootfruit at gmail.com
Mon Jul 24 23:52:51 EDT 2006


Why does this work:

# start
a = 5

print a, 'is the number'

#end, prints out "5 is the number"

But not this:

# start

a = 5

print a 'is the number'

#end, errors out

The difference here is the comma seperating the variable and the string
literal. Is the comma some sort of concatenation operator or is the comma
necessary in some form of a requirement in the print function, i.e is the
variable a an argument to print as well as 'is th number' another argument
to print?

-- 
Thanks,

Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060724/bc458e93/attachment.html>


More information about the Python-list mailing list