七日派息计算
1 import datetime 2 3 if __name__ == '__main__': 4 day1 = datetime.date(2020,7,13) 5 day2 = day1 + datetime.timedelta(days=1) 6 result = [] 7 for i in range(1,100): 8 if i % 7 == 0 : 9 result.append('第%d天,日期:%s,派息' % (i, day2)) 10 else: 11 result.append('第%d天,日期:%s' % (i, day2)) 12 day2 = day2 + datetime.timedelta(days=1) 13 print('\n'.join(result))