string formatting

Chris Angelico rosuav at gmail.com
Fri May 6 20:09:49 EDT 2011


On Sat, May 7, 2011 at 6:54 AM, Terry Reedy <tjreedy at udel.edu> wrote:
> def emsg(x):
>  if isinstance(x,tuple):
>    x = (x,)
>  print(The following object caused a proplem: %s" % x)
>

Couldn't you just do that unconditionally?
print(The following object caused a proplem: %s" % (x,))

Chris Angelico



More information about the Python-list mailing list