这个答案在 python 2 和 python 3 中,当我运行这段代码时,我得到这个错误:
print(self.last_day_of_month(start)) TypeError: last_day_of_month() takes 1 positional argument but 2 were given
start 是一个日期时间对象 (datetime.date(someyear, somemonth, someday) 所以它应该与问题中给出的答案完全相同。
这是因为答案在 python 2 中吗?如果是这样,我将如何重写它以便它在 python 3 中工作?
慕码人8056858
相关分类