import math
num = -0.002342
print('{}.{}e{}{}'.format('+' if num >= 0 else '-', str(abs(num)).replace(
    '.', '').lstrip('0'), '+' if abs(num) >= 1 else '-', str(abs(int(math.
    log10(abs(num)) + (1 if abs(num) > 1 else 0)))).zfill(2)))
How to force exponential number to be print with leading dot in python?