can't compare datetime.datetime to datetime.date

前端 未结 6 2031
野趣味
野趣味 2020-12-05 12:20

I have the following code and am getting the above error. Since I\'m new to python I\'m having trouble understanding the syntax here and how I can fix the error:

<         


        
6条回答
  •  南方客
    南方客 (楼主)
    2020-12-05 13:14

    Your variables start and date are of different type I guess. One is a datetime and one is a date. You may have to show more code in order to get decent help.

    But look at this: http://docs.python.org/library/datetime.html#available-types

    It tells you that datetime.datetime has attributes like day, month and year, just like datetime.date.

提交回复
热议问题