That can be done much simpler considering that int(True) is 1 and int(False)
is 0:
from datetime import datedef calculate_age(born): today = date.today() return today.year - born.year - ((today.month, today.day) < (born.month, born.day))
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)