点开几个网页,都是下面这样的解决方案:
import numpy as np
np.set_printoptions(suppress=True)
有人说没用,有人说有用
我想了下,想到了格式化,测试代码如下:
# -*- coding: utf-8 -*-
import random
random.seed(2020)
num = random.uniform(1e-14, 1e-13)
print(num)
import numpy as np
np.set_printoptions(suppress=True)
print(num) # 本地测试numpy方式没用
print('%.100f' % num) # 方式一,亲测有用,根据需求指定保留位数
print('{:.100f}'.format(num)) # 方式二
"""
6.577023435945954e-14
6.577023435945954e-14
0.0000000000000657702343594595441171586581805219197399562172656750647092849249020218849182128906250000
0.0000000000000657702343594595441171586581805219197399562172656750647092849249020218849182128906250000
"""