Re: difference between %s and %d

2010-10-01 Thread Arnaud Delobelle
Ethan Furman writes: > If I'm printing the number 735, or any other positive or negative > integer, is there any difference between %7s and %7d? > > ~Ethan~ To link with another thread: >>> "%s" % True 'True' >>> "%d" % True '1' -- Arnaud -- http://mail.python.org/mailman/listinfo/python-lis

Re: difference between %s and %d

2010-10-01 Thread Ethan Furman
Ethan Furman wrote: If I'm printing the number 735, or any other positive or negative integer, is there any difference between %7s and %7d? Grant Edwards wrote: > Let's ask Python: > > --> [n for n in range(-,,123) if ("%7d" % n) > != ("%7s" % n)] > [] > > --> [n

Re: difference between %s and %d

2010-10-01 Thread MRAB
On 01/10/2010 20:15, Ethan Furman wrote: If I'm printing the number 735, or any other positive or negative integer, is there any difference between %7s and %7d? "%s" uses str(). In Python 2.7: >>> class MyInt(int): ... def __init__(self, value): ... int.__init__(self, value) ...

Re: difference between %s and %d

2010-10-01 Thread Grant Edwards
On 2010-10-01, Ethan Furman wrote: > If I'm printing the number 735, or any other positive or negative > integer, is there any difference between %7s and %7d? Let's ask Python: >>> [n for n in range(-,,123) if ("%7d" % n) != ("%7s" % n)] [] >>> [n for n in range(-9,99