可以使用set_printoptions
设置输出精度:
import numpy as np
# 设置输出3位小数
np.set_printoptions(precision=3)
a = np.sqrt([5, 6, 7])
print(a)
执行结果:
[2.236 2.449 2.646]
可以使用set_printoptions
设置输出精度:
import numpy as np
# 设置输出3位小数
np.set_printoptions(precision=3)
a = np.sqrt([5, 6, 7])
print(a)
执行结果:
[2.236 2.449 2.646]