📜  python代码示例中的年龄计算器

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

代码示例4
from datetime import date

def calculate_age(born):
    today = date.today()
    return today.year - born.year - ((today.month, today.day) < (born.month, born.day))