Simple string formatting question
Ben Finney
bignose+hates-spam at benfinney.id.au
Thu Apr 6 08:16:05 EDT 2006
"Steven D'Aprano" <steve at REMOVEMEcyber.com.au> writes:
> I have a sinking feeling I'm missing something really, really
> simple.
"Oh no, everyone in the galaxy gets that, that's perfectly natural
paranoia."
> 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.
--
\ "I have an answering machine in my car. It says, 'I'm home now. |
`\ But leave a message and I'll call when I'm out.'" -- Steven |
_o__) Wright |
Ben Finney
More information about the Python-list
mailing list