How can get following formatting (input values are always less than 0.1):
> formatting(0.09112346) 0.91123E-01 > formatting(0.00112346) 0.11234E-02
In Python 3.6+, you could also use f-strings. For example:
In [31]: num = 0.09112346 In [32]: f'{num:.5E}' Out[32]: '9.11235E-02'
It uses the same syntax as str.format(), given in the Format Specification Mini-Language section.
str.format()