【Python】计算两个日期相差多少天

    @staticmethod
    def cha_count(start: str, end: str):
        """
        计算两个日期相差多少天
        @param start: '20210820'
        @param end: '20210827'
        @return: 7
        """
        old = datetime.datetime(int(start[0:4]), int(start[4:6]), int(start[6:8]))
        now = datetime.datetime(int(end[0:4]), int(end[4:6]), int(end[6:8]))
        count = (now - old).days
        print(count)
        return count
如果忍耐算是坚强 我选择抵抗 如果妥协算是努力 我选择争取
原文地址:https://www.cnblogs.com/danhuai/p/15193327.html