N
Neal Becker
Like a puzzle? I need to interface python output to some strange old
program. It wants to see numbers formatted as:
e.g.: 0.23456789E01
That is, the leading digit is always 0, instead of the first significant
digit. It is fixed width. I can almost get it with '% 16.9E', but not
quite.
My solution is to print to a string with the '% 16.9E' format, then parse it
with re to pick off the pieces and fix it up. Pretty ugly. Any better
ideas?
program. It wants to see numbers formatted as:
e.g.: 0.23456789E01
That is, the leading digit is always 0, instead of the first significant
digit. It is fixed width. I can almost get it with '% 16.9E', but not
quite.
My solution is to print to a string with the '% 16.9E' format, then parse it
with re to pick off the pieces and fix it up. Pretty ugly. Any better
ideas?