convert exponential to decimal in python

后端 未结 3 1487
你的背包
你的背包 2021-01-12 22:40

I have an array in python that contains a set of values, some of them are

2.32313e+07

2.1155e+07

1.923e+07

11856

112.32

How d

3条回答
  •  日久生厌
    2021-01-12 23:18

    In answer to the last part of your question, awk can use the same printf format:

    awk '{printf "%f\n",$1}' exponential_file
    

    Where exponential_file contains:

    2.32313e+07
    2.1155e+07
    1.923e+07
    11856
    112.32
    

    You can do the conversion into a variable for use later. Here is a simplistic example:

    awk '{n = sprintf("%f\n",$1); print n * 2}' exponential_file
    

提交回复
热议问题