Re: string formatter for tuple

2006-11-02 Thread jeremito
[EMAIL PROTECTED] wrote: > > "Tim" == Tim Chase <[EMAIL PROTECTED]> writes: > > >> How can I print a tuple with a single string format? > > Tim>print "a = %s" % str(a) > Tim> or > Tim>print "a = %s" % repr(a) > > Or wrap the tuple in a tuple: > > print "a =

Re: string formatter for tuple

2006-11-02 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, jeremito wrote: > I have the following in my code > > a = (1,2,3) > print "a = %s" %a > > But when I run this, I get: > > TypeError: not all arguments converted during string formatting > > Now I realize why this happens, a is actually 3 elements when the print > statem

Re: string formatter for tuple

2006-11-02 Thread Wojciech Muła
Tim Chase wrote: > print "a = %s" % repr(a) or print "a = %r" % (a,) -- http://mail.python.org/mailman/listinfo/python-list

Re: string formatter for tuple

2006-11-02 Thread skip
> "Tim" == Tim Chase <[EMAIL PROTECTED]> writes: >> How can I print a tuple with a single string format? Tim>print "a = %s" % str(a) Tim> or Tim>print "a = %s" % repr(a) Or wrap the tuple in a tuple: print "a = %s" % (a,) Skip -- http://mail.python.org/

Re: string formatter for tuple

2006-11-02 Thread Steve Holden
jeremito wrote: > I have the following in my code > > a = (1,2,3) > print "a = %s" %a > > But when I run this, I get: > > TypeError: not all arguments converted during string formatting > > Now I realize why this happens, a is actually 3 elements when the print > statement is only expecting to

Re: string formatter for tuple

2006-11-02 Thread Tim Chase
> a = (1,2,3) > print "a = %s" %a > > But when I run this, I get: > > TypeError: not all arguments converted during string formatting > > Now I realize why this happens, a is actually 3 elements when the print > statement is only expecting to print one value. I tried > > print "a = %s" %(a) >

string formatter for tuple

2006-11-02 Thread jeremito
I have the following in my code a = (1,2,3) print "a = %s" %a But when I run this, I get: TypeError: not all arguments converted during string formatting Now I realize why this happens, a is actually 3 elements when the print statement is only expecting to print one value. I tried print "a =