[Tutor] Why has this syntax with multiple arguments ceased to
work for the print command?
Terry Carroll
carroll at tjc.com
Sat Dec 20 18:25:59 EST 2003
On Sat, 20 Dec 2003, hcohen2 wrote:
> I am certain code like this ran for me without any problem:
>
> print 'You are: %s? and It is the %dth of Dec.' % esp, int(cnt)
There should be *one* argument on each side of the "%"; although the
rightmost one can be a tuple that contains two elements.
Try, instead:
print 'You are: %s? and It is the %dth of Dec.' % (esp, int(cnt))
> It appears that the syntax has altered from what was working on version
> 2.0.x.
I don't think so; the first fails with the same error for me on Pythons
1.5.2, 2.2.2 and 2.3.3; and the second works correctly on all three.
--
Terry Carroll
Santa Clara, CA
carroll at tjc.com
More information about the Tutor
mailing list