On Thu, 06 Apr 2006 22:16:05 +1000, Ben Finney wrote: > "Steven D'Aprano" <[EMAIL PROTECTED]> writes:
>> I'm looking for a format string similar to '%.3f' except that >> trailing zeroes are not included. > > Can;t be done, to my knowledge. You specify a particular precision, > and the number will be formatted at that precision. This matches the > 'printf' behaviour that inspired string formatting operations. > > If your brute-force approach works, stick to that until you have a > reason to look for something better. Thanks to everybody who replied, I'm glad to see I didn't miss anything. I do actually have a reason for wanting a single format pattern, but I can probably work with what I have, it will just be less convenient. I hesitate to suggest this, what with the whole PEP procedure and all being so intimidating to those who aren't familiar with it (e.g. me), but would there be any interest in extending the formatting operations to include such a feature? It would (presumably) break compatibility with printf, but does that matter? -- Steven. -- http://mail.python.org/mailman/listinfo/python-list