limited float decimal point without rounding the number [duplicate]
问题 This question already has answers here : Truncating floats in Python (29 answers) Closed 2 years ago . I want convert a number to a float number with 3 decimal point but I want it without rounding. For example: a = 12.341661 print("%.3f" % a) This code return this number: 12.342 but I need to original number,I need this: 12.341 I write a code that receive a number form user and convert it to a float number. I have no idea that what is the number entered with user. 回答1: My first thought was to