如何在python中从用户未输入的月份中提取月份名称?
我想知道如何使用strftime和datetime方法从用户在python中输入的月号中获取月名 我试过这个如何在python中从用户未输入的月份中提取月份名称?,python,Python,我想知道如何使用strftime和datetime方法从用户在python中输入的月号中获取月名 我试过这个 inp=input('enter the month no ') a=datetime.date(inp).strftime("%B") print(a) 请告诉我正确的代码您需要创建一个包含年、月和日的日期对象,因此请为这些参数包含垃圾值 inp=input('enter the month no ') a=datetime.date(1, int(inp), 1).strftime
inp=input('enter the month no ')
a=datetime.date(inp).strftime("%B")
print(a)
请告诉我正确的代码您需要创建一个包含年、月和日的日期对象,因此请为这些参数包含垃圾值
inp=input('enter the month no ')
a=datetime.date(1, int(inp), 1).strftime("%B")
print(a)
是的,我明白了,非常感谢