Converting exponential to float

前端 未结 6 1438
余生分开走
余生分开走 2020-12-18 08:55

This is my code, trying to convert the second field of the line from exponential into float.

outputrrd = processrrd.communicate()
(output, error) = outputrrd         


        
6条回答
  •  梦毁少年i
    2020-12-18 09:21

    This work for me, try it out.

    def remove_exponent(value):
        decial = value.split('e')
        ret_val = format(((float(decial[0]))*(10**int(decial[1]))), '.8f')
        return ret_val
    

提交回复
热议问题