Re: I need a neat way to print nothing or a number

2013-03-27 Thread Wolfgang Maier
Chris Angelico gmail.com> writes: > > On Wed, Mar 27, 2013 at 4:06 AM, Wolfgang Maier > biologie.uni-freiburg.de> wrote: > > Chris Angelico gmail.com> writes: > > > >> > >> Try printing out this expression: > >> > >> "%.2f"%value if value else '' > >> > >> Without the rest of your code I can't

Re: I need a neat way to print nothing or a number

2013-03-26 Thread Chris Angelico
On Wed, Mar 27, 2013 at 4:21 AM, Ethan Furman wrote: > On 03/26/2013 10:06 AM, Wolfgang Maier wrote: >> >> Chris Angelico gmail.com> writes: >> >>> >>> Try printing out this expression: >>> >>> "%.2f"%value if value else '' >>> >>> Without the rest of your code I can't tell you how to plug that i

Re: I need a neat way to print nothing or a number

2013-03-26 Thread Ethan Furman
On 03/26/2013 10:06 AM, Wolfgang Maier wrote: Chris Angelico gmail.com> writes: Try printing out this expression: "%.2f"%value if value else '' Without the rest of your code I can't tell you how to plug that in, but a ternary expression is a good fit here. ChrisA Unfortunately, that's n

Re: I need a neat way to print nothing or a number

2013-03-26 Thread Peter Otten
Wolfgang Maier wrote: > Chris Angelico gmail.com> writes: > >> >> Try printing out this expression: >> >> "%.2f"%value if value else '' >> >> Without the rest of your code I can't tell you how to plug that in, >> but a ternary expression is a good fit here. >> >> ChrisA >> > > Unfortunately

Re: I need a neat way to print nothing or a number

2013-03-26 Thread Chris Angelico
On Wed, Mar 27, 2013 at 4:06 AM, Wolfgang Maier wrote: > Chris Angelico gmail.com> writes: > >> >> Try printing out this expression: >> >> "%.2f"%value if value else '' >> >> Without the rest of your code I can't tell you how to plug that in, >> but a ternary expression is a good fit here. >> >>

Re: I need a neat way to print nothing or a number

2013-03-26 Thread Wolfgang Maier
Chris Angelico gmail.com> writes: > > Try printing out this expression: > > "%.2f"%value if value else '' > > Without the rest of your code I can't tell you how to plug that in, > but a ternary expression is a good fit here. > > ChrisA > Unfortunately, that's not working, but gives a TypeErr

Re: I need a neat way to print nothing or a number

2013-03-26 Thread John Gordon
In c...@isbd.net writes: > What's a neat way to print columns of numbers with blanks where a number > is zero or None? print number or ' ' -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: I need a neat way to print nothing or a number

2013-03-26 Thread Chris Angelico
On Wed, Mar 27, 2013 at 2:50 AM, wrote: > What's a neat way to print columns of numbers with blanks where a number > is zero or None? > > E.g. I want to output something like:- > > Credit Debit Description > 100.00 Initial balance > 123.45 Payment for

I need a neat way to print nothing or a number

2013-03-26 Thread cl
What's a neat way to print columns of numbers with blanks where a number is zero or None? E.g. I want to output something like:- Credit Debit Description 100.00 Initial balance 123.45 Payment for cabbages 202.00 Telephone bill For ea