为了账号安全,请及时绑定邮箱和手机立即绑定

这个答案的python 3版本是什么?

这个答案的python 3版本是什么?

蝴蝶刀刀 2022-06-28 17:42:08
这个答案在 python 2 和 python 3 中,当我运行这段代码时,我得到这个错误:print(self.last_day_of_month(start)) TypeError: last_day_of_month() takes 1 positional argument but 2 were givenstart 是一个日期时间对象 (datetime.date(someyear, somemonth, someday) 所以它应该与问题中给出的答案完全相同。这是因为答案在 python 2 中吗?如果是这样,我将如何重写它以便它在 python 3 中工作?
查看完整描述

1 回答

?
慕码人8056858

TA贡献1803条经验 获得超6个赞

为了last_day_of_month()

  • 用作self第一个参数,并且

  • 用作start第二个参数,

所以,做last_day_of_month(self, start)


查看完整回答
反对 回复 2022-06-28
  • 1 回答
  • 0 关注
  • 131 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号