Descriptor 'date' requires a 'datetime.datetime' object but received a 'unicode'

◇◆丶佛笑我妖孽 提交于 2019-12-06 01:33:30

By using from datetime import datetime, timedelta you have imported the datetime type from the datetime module. Thus when you call datetime.date you are calling a method on the datetime type.

I think what you want is to use the date type from the datetime module:

  1. Change your import to from datetime import datetime, timedelta, date.
  2. Call date(year, month, 1) instead of datetime.date(year, month, 1).
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!