#时间补全:目前只能往前一步找deftime_complement(time_list,loca_time):
year = re.findall('\d{1,4}年',loca_time)
mounth = re.findall('\d{1,2}月',loca_time)
day = re.findall('\d{1,2}日',loca_time)
hour = re.findall('\d*时\d*分',loca_time)
time_sub = time_list[-1]for i inrange(1):if year ==[]:
year = re.findall('\d{1,4}年',time_sub)else:breakif mounth ==[]:if'月'in time_sub:
mounth = re.findall('\d{1,2}月',time_sub)else:mounth =['']else:
day =['']breakif day ==[]and'日'in time_sub:
day = re.findall('\d{1,2}日', time_sub)break
time = year[0]+ mounth[0]+ day[0]+hour[0]print(time)return time
# t = '1月日1时20分'# t_list = ['2015年']# time_complement(t_list,t)