输入三个值,分别代表年.月.日。以1998-05-23形式显示这三个数。要求:不能以字符串形式输入数字,数字必须转为int型存储)
# def put_date():
# year = int(input("num1:"))
# month = int(input("num2:"))
# days = int(input("num3:"))
# print(datetime.date(year, month, days))
#
#
# put_date()
year, month, day = eval(input("请依次输入年月日:"))
print(year, "-", '%.2d' % month, "-", '%.2d' % day)
运行结果: