📜  python remove .0 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:19.882000             🧑  作者: Mango

代码示例1
number = 5.0
number = int(number)
# 5

# Safety net if number is not equal to int
def safe_int(number: float):
    if number - int(number) == 0:
        return int(number)