print - bug or feature - concatenated format strings in a print statement

bdb112 boyd.blackwell at gmail.com
Mon Mar 16 04:04:02 EDT 2009


#whoops, the first output is actually

 1,  2, buckle my shoe

# in case it wasn't obvious


On Mar 16, 5:00 pm, bdb112 <boyd.blackw... at gmail.com> wrote:
> #   is the difference between
> print(" %d,  %d, buckle my shoe" % (1,2))
> #   and
> print(" %d, " + " %d, buckle my shoe" % (1,2))
> # a bug or a feature?
>
> First output
> ... print(" %d " + " %d, buckle my shoe" % (1,2))
>
> Second output
> TypeError: not all arguments converted during string formatting
>
> Version Info:
> Python 2.5.1 (r251:54863, Oct 30 2007, 13:54:11)
> [GCC 4.1.2 20070925 (Red Hat 4.1.2-33)] on linux2
>
> also
>
> Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit
> (Intel)] on win32




More information about the Python-list mailing list