有没有办法打印递增月份的名称?
import datetime
currentDT = datetime.datetime.now()
currentmonth=currentDT.strftime("%B")
nextmonth = datetime.date.today().month + 1
这里我得到整数形式的“下一个月”。
7
但是我怎样才能知道那个月的名字,也就是七月。我甚至试过用这个,
next_month=nextmonth.strftime("%B")
但它返回了错误,
AttributeError: 'int' object has no attribute 'strftime'