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)
...     def __str__(self):
...         return "MyInt(%d)" % self
...
>>> MyInt(735)
735
>>> "%7d" % MyInt(735)
'    735'
>>> "%7s" % MyInt(735)
'MyInt(735)'
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to