If x
is a NumPy array, then you could use
np.set_printoptions(formatter={'float': '{: 0.8e}'.format})
to change the way floats are displayed:
import numpy as np
x = np.array([76809102.22, 38393173.33, -17066.67, -48000000., 0., 0., -28809102.22,
-38393173.33, -17066.67])
np.set_printoptions(formatter={'float': '{: 0.8e}'.format})
print(x)
yields
[ 7.68091022e+07 3.83931733e+07 -1.70666700e+04 -4.80000000e+07
0.00000000e+00 0.00000000e+00 -2.88091022e+07 -3.83931733e+07
-1.70666700e+04]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…