f=open("tv.csv","r",encoding='utf-8')
x=[]
for line in f:
x.append(line)
f.close()
y1=[]
m1=[]
y2=[]
m2=[]
code=[]
t=[]
for i in range(len(x)-1):
x2=x[i+1].split(",")
y1.append(int(x2[1]))
m1.append(int(x2[2]))
y2.append(int(x2[3]))
m2.append(int(x2[4]))
t.append(x2[7])
code.append(x2[9])
g=open("ar.csv","r",encoding='utf-8')
q=[]
for line in g:
q.append(line)
g.close()
c1="240468"
tv=[]
for i in range(len(q)-1):
x3=q[i+1].split(",")
h=0
if x3[4]==c1:h=h+1
dex=""+x3[5]
if len(dex)<1:h=h+1
if h==2:tv.append(x3[2])
point=[]
for i in range(480):
point.append(0)
for t1 in tv:
for m in range(len(code)):
if code[m]==t1:
n1=12*(y1[m]-1980)+m1[m]
n2=12*(y2[m]-1980)+m2[m]
for j in range(n1,n2+1):
point[j]=point[j]+1
yy1=[]
yy2=[]
mm1=[]
mm2=[]
for i in range(len(q)-1):
x3=q[i+1].split(",")
h=0
if x3[4]==c1:h=h+1
dex=""+x3[5]
if len(dex)>1:h=h+1
if h==2:yy1.append(x3[5])
if h==2:mm1.append(x3[6])
if h==2:yy2.append(x3[7])
if h==2:mm2.append(x3[8])
for i in range(len(yy1)):
yyy2=yy2[i]
mmm2=mm2[i]
if len(yyy2)==0:mmm2=12
if len(yyy2)==0:yyy2=2017
n1=12*(int(yy1[i])-1980)+int(mm1[i])
n2=12*(int(yyy2)-1980)+int(mmm2)
for j in range(n1,n2+1):
point[j]=point[j]+1
px=[]
for i in range(38):
n1=12*(i-1)
n2=n1+12
z=0
for j in range(n1,n2):
if point[j]>z:z=point[j]
px.append(z)
f1=open("m.txt","w",encoding='utf-8')
for i in range(len(px)):
f1.write(str(1980+i)+"年,"+str(px[i])+"\n")
f1.close()
最終更新:2018年02月10日 13:17