x_month=['07-01','07-02','07-03','07-04','07-05','07-06','07-07','07-08','07-09','07-10','07-11','07-12','07-13','07-14','07-15','07-16','07-17','07-18','07-19','07-20','...
x_month = ['07-01', '07-02', '07-03', '07-04', '07-05', '07-06', '07-07', '07-08', '07-09', '07-10', '07-11','07-12', '07-13', '07-14', '07-15', '07-16', '07-17', '07-18', '07-19', '07-20', '07-21','07-22', '07-23', '07-24', '07-25', '07-26', '07-27', '07-28', '07-29', '07-30', '07-31']
time_tiqu2 = ['2020-07-03', '2020-07-06', '2020-07-08', '2020-07-08', '2020-07-08', '2020-07-09', '2020-07-09', '2020-07-12', '2020-07-22', '2020-07-22', '2020-07-23', '2020-07-24', '2020-07-24', '2020-07-24', '2020-07-24', '2020-07-24', '2020-07-24', '2020-07-24', '2020-07-25', '2020-07-25', '2020-07-25', '2020-07-27', '2020-07-27', '2020-07-28', '2020-07-30', '2020-07-30', '2020-07-30', '2020-07-30', '2020-07-31']
以上两个列表,我想判断x_month列表是否在time_tiqu2中,用了以下的判断方式是错误的,无法输出07-03这种存在的数据,请问如何能进行匹配?虽然缺少年份信息,但是有没有模糊匹配之类的
if x_month[2] in time_tiqu2:
print("yes")
else:
print("time_tiqu2:%s" %time_tiqu2[0])
print(x_month[2])
print("no")
展开