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

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

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

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, c...@isbd.net 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

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

2013-03-26 Thread John Gordon
In jms82a-6sl@chris.zbmc.eu 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,

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

2013-03-26 Thread Wolfgang Maier
Chris Angelico rosuav at 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 TypeError:

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 wolfgang.ma...@biologie.uni-freiburg.de wrote: Chris Angelico rosuav at 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

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

2013-03-26 Thread Peter Otten
Wolfgang Maier wrote: Chris Angelico rosuav at 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

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 rosuav at 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:21 AM, Ethan Furman et...@stoneleaf.us wrote: On 03/26/2013 10:06 AM, Wolfgang Maier wrote: Chris Angelico rosuav at 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