#numpy不以科学计数法输出
np.set_printoptions(suppress=True)
#pandas不以科学计数法输出,最大显示无省略号行列【10*10】
pd.set_option('display.max_columns', 10, 'display.max_rows', 10,'display.float_format', lambda x: '%.2f' %x)
#平时不以科学计数法输出
print("x= {0:.4f}, y = {1:.4f}".format(x,y))
冒号前是变量位置,如果只输出一个变量可以不写,即
print("x= {:.4f}".format(x))
冒号后是输出格式限制,可以不写,即
print("x= {:}".format(x))

测试代码如下:
x=10000000000000000000/3
y=11111111111111111111/3
print(x)
print(y)
print("x= {:}".format(x))
print("x= {:.4f}".format(x))
print("x= {0:.4f}, y = {1:.4f}".format(x,y))

输出如下:

python 不以科学计数法输出

 

相关文章:

  • 2021-12-01
  • 2021-11-21
  • 2021-09-29
  • 2018-07-07
  • 2021-11-29
  • 2021-12-12
  • 2021-09-29
猜你喜欢
  • 2021-12-02
  • 2021-12-12
  • 2021-12-02
  • 2021-11-21
  • 2021-12-12
  • 2021-11-19
  • 2021-09-20
  • 2021-11-19
相关资源
相似解决方案