How do I find missing dates in a list of sorted dates?

前端 未结 8 1307
孤街浪徒
孤街浪徒 2021-02-04 04:15

In Python how do I find all the missing days in a sorted list of dates?

8条回答
  •  一生所求
    2021-02-04 04:39

    Put the dates in a set and then iterate from the first date to the last using datetime.timedelta(), checking for containment in the set each time.

提交回复
热议问题