#! /usr/bin/env python
# -*- coding:utf-8 -*-
from datetime import datetime, date, timedelta
m = [('JD','2018-11-08'),('Aussie FS','2018-10-10'),('Braun FS','2018-11-09'),('Global FS','2018-11-07')]
t = [('JD', '2018-09-10'),('JD', '2018-09-11'),('JD', '2018-09-12'),
('JD', '2018-09-13'),
('JD', '2018-09-14'),
('JD', '2018-09-15'),
('JD', '2018-11-08'),
('Aussie FS', '2018-10-02'),
('Aussie FS', '2018-10-03'),
('Aussie FS', '2018-10-04'),
('Aussie FS', '2018-10-05'),
('Aussie FS', '2018-10-06'),
('Aussie FS', '2018-10-07'),
('Aussie FS', '2018-10-08'),
('Braun FS', '2018-10-28'),
('Braun FS', '2018-11-08'),
('Braun FS', '2018-10-30'),
('Braun FS', '2018-10-31'),
('Braun FS', '2018-11-01'),
('Global FS', '2018-09-18'),
('Global FS', '2018-09-19'),
('Global FS', '2018-09-20'),
('Global FS','2018-11-08'),
('Global FS', '2018-09-22'),
('Global FS', '2018-09-23')
]
mm = '2018-11-08'
for x in range(0, len(m)):
n = []
n_new = []
i = 0
while i len(t):
if t[i][0] == m[x][0]:
n.append([t[i][0], t[i][1]])
i += 1
n_new = sorted(list(n))
if n_new[-1][1] != mm:
print '%s最大業(yè)務(wù)時間為:%s,沒有到達T-1:%s'%(n_new[-1][0],n_new[-1][1],mm)
def get_nday_list(n):
before_n_days = []
for i in range(1, n + 1)[::-1]:
before_n_days.append(str(date.today() - timedelta(days=i)))
return before_n_days
a = get_nday_list(10)
b = get_nday_list(30)
ttt = []
for x in range(0, len(m)):
d = []
d_new = []
i = 0
while i len(t):
if t[i][0] == m[x][0]:
d.append([t[i][0], t[i][1]])
i += 1
d_new = sorted(list(d))
print d_new
ll = []
for xx in range(0,len(d_new)):
ll.append(d_new[xx][1])
kk = 0
while kklen(a):
if a[kk] not in ll:
ttt.append([m[x][0],a[kk]])
kk +=1
print '業(yè)務(wù)日期缺失的為:%s'%(ttt)