I want to format a list of numbers with a fixed exponential format:
0.xxxxxxxxxxxxEsee
If the number is negative, the value 0 must be replaced with 0:
-.xxxxxxxxxxxxEsee
Can I accomplish this with a format string? For example.
output.write('{:+016.10E}{:+016.10E}{:+016.10E}\n'.format(a,b,c))
It works beautifully, but does not fill the requirements for zero, and also gives the lead 0..
Example output would be
-.704411727284E+00-.166021493805E-010.964452299466E-020.229380762349E-07
-.103417103118E-05-.269314547877E-040.140398741573E-020.000000000000E+00
0.000000000000E+00-.704410110737E+00-.166019042695E-010.964139641580E-02
-.196412061468E-070.125311265867E-050.269427086293E-04-.140464403693E-02
0.000000000000E+000.000000000000E+00-.496237902548E-020.505395880357E-03
-.332217159196E-02-.192047286272E-030.139005979401E-02-.146291733047E-03
0.947012666403E-030.000000000000E+000.000000000000E+00-.496237514486E-02
0.505449126498E-03-.332395118617E-020.192048881658E-03-.139035528110E-02
source
share