decimal-point

Format a number containing a decimal point with leading zeroes

Format a number containing a decimal point with leading zeroes Question: I want to format a number with a decimal point in it with leading zeros. This >>> ‘3.3’.zfill(5) 003.3 considers all the digits and even the decimal point. Is there a function in python that considers only the whole part? I only need to …

Total answers: 6

Convert decimal mark when reading numbers as input

Convert decimal mark when reading numbers as input Question: I have a CSV file with data reading that I want to read into Python. I get lists that contain strings like “2,5”. Now doing float(“2,5”) does not work, because it has the wrong decimal mark. How do I read this into Python as 2.5? Asked …

Total answers: 7