Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/301.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在将python浮动写入文件时使用Suppress科学符号_Python_Floating Point_Notation - Fatal编程技术网

在将python浮动写入文件时使用Suppress科学符号

在将python浮动写入文件时使用Suppress科学符号,python,floating-point,notation,Python,Floating Point,Notation,将浮动写入CSV会将其中一些写入如下:2.062880099772577E-05 c = csv.writer(open(file, "wb")) c.writerow([var1, var2]) 我所尝试的: 我已经尝试了var1**8,下面是关于 StackOverflow,但这只是将它们提升到8的幂 我也尝试过十进制(var1),但这并不能抑制科学性 符号 这使得以后很难在excel中处理输出,因为它被识别为文本而不是数字。我如何用非科学的十进制表示法打印它 '%f' % y

将浮动写入CSV会将其中一些写入如下:2.062880099772577E-05

c = csv.writer(open(file, "wb"))
c.writerow([var1, var2])    
我所尝试的:

  • 我已经尝试了var1**8,下面是关于 StackOverflow,但这只是将它们提升到8的幂
  • 我也尝试过十进制(var1),但这并不能抑制科学性 符号
这使得以后很难在excel中处理输出,因为它被识别为文本而不是数字。我如何用非科学的十进制表示法打印它

'%f' % your_var
或控制精度:

'%0.10f' % your_var
使用:

c.writerow(['{:f}'.format(var) for var in (var1, var2)]