def days(start,end): start_day = datetime.datetime.strptime(start,"%Y-%m-%d") end_day = datetime.datetime.strptime(end,"%Y-%m-%d") num = (end_day - start_day).days return num def months(start,end): start_year = datetime.datetime.strptime(start,"%Y-%m-%d").year end_year = datetime.datetime.strptime(end,"%Y-%m-%d").year start_month = datetime.datetime.strptime(start,"%Y-%m-%d").month end_month = datetime.datetime.strptime(end,"%Y-%m-%d").month num = (end_year-start_year) * 12 + (end_month-start_month) return num d = days('2019-11-11','2019-11-12') # 1 m = months('2019-10-11','2019-12-11') # 2


在变量左边添加元素值。 redisTemplate.opsForList().leftPush("list","a"); redisTemplate.opsForList().leftPush("list","b"); redisTemplate.opsForList().leftPush("list","c");