Format String: Only when value supplied

2014-06-24 Thread Florian Lindner
Hello, I have a format string like: print {:10} {:25} = {:6} ({}).format(mod, name, value, description) description can be None. In this case I want to print an empty string (which can be achieved by replacing it with 'description or ') and I want to omit the brackets. Is there a way to

Re: Format String: Only when value supplied

2014-06-24 Thread Ned Batchelder
On 6/24/14 5:18 AM, Florian Lindner wrote: Hello, I have a format string like: print {:10} {:25} = {:6} ({}).format(mod, name, value, description) description can be None. In this case I want to print an empty string (which can be achieved by replacing it with 'description or ') and I

Re: Format String: Only when value supplied

2014-06-24 Thread MRAB
On 2014-06-24 10:18, Florian Lindner wrote: Hello, I have a format string like: print {:10} {:25} = {:6} ({}).format(mod, name, value, description) description can be None. In this case I want to print an empty string (which can be achieved by replacing it with 'description or ') and I