Holger kirjoitti:
>
> I would like to do the equivalent if python of the C line:
> printf("I saw %d car%s\n", n, n != 1 ? "s" : "")
> 
> Please help
> 
> /Holger
> 

In this particular case you don't need the ternary operator:

        print "I saw %d car%s\n" % (n, ("", "s")[n != 1])


Cheers,
Jussi
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to