How can I convert float to str without losing significant digits?

I want to convert the number 0.054000to str, but when I write srt(0.054000), I get '0.054'. I need to get one '0.054000'. How can i do this?

I have an example data file with numbers (0.054000). I need to count the numbers of each number. I do not know how to read this number in such a way as to, for example, count seven digits.

+4
source share
1 answer

I think Dan Patterson's method is the only way to do this reliably - python makes no distinction between .0054 and .054000: for example.

>>> .0054 is .0054000
True

, , , , -, , (str(.0054000) + "0"*number_of_sig_figs).

0

All Articles