Python: Remove division decimal
问题 I have made a program that divides numbers and then returns the number, But the thing is that when it returns the number it has a decimal like this: 2.0 But I want it to give me: 2 so is there anyway I can do this? Thanks in Advance! 回答1: You can call int() on the end result: >>> int(2.0) 2 回答2: When a number as a decimal it is usually a float in Python. If you want to remove the decimal and keep it an integer (int). You can call the int() method on it like so... >>> int(2.0) 2 However, int