can't compare datetime.datetime to datetime.date

前端 未结 6 2028
野趣味
野趣味 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:21

    There is a datetime.date() method for converting from a datetime to a date.

    To do the opposite conversion, you could use this function datetime.datetime(d.year, d.month, d.day)

提交回复
热议问题