Test done with python 3.10
With xx = 1.e-4, I can have a nice print with print ( np.format_float_scientific (xx, precision=0, exp_digits=1, unique=True, trim='-') ). It prints 1e-4, the result I want.
But this is a bunch of code for a rather simple task.
Can I control the length of the exponent with a formatted print ?
print ( f'{xx:3.0e}' ) -> 1e-04
print ( '{:3.0e}'.format(xx) ) -> 1e-04
Is there a way to have only one digit in the exponent ?
Olivier
I'd simply replace the leading zero:
Prints: