#Python implementations get the current time 12 months ago every month#Assuming the current time is September 25, 2016.#to get the time now is equal to September 25, 2016now =Datetime.datetime.now ()#get this year's time (year) get the today_year equals 2016Today_year =Now.year#this year's time minus 1, get last year's time. Last_year equalslast_year = Int (now.year)-1#get the time of this year's every month. Today_year_months equals 1 2 3 4 5 6 7 8 9,Today_year_months = Range (1,now.month+1)#get last year's every month time last_year_months equals tenLast_year_months = Range (now.month+1, 13)#define the data for the list last yearData_list_lasts = []#get a list of last year's time clip months through a for loop#go through the list of last month forLast_year_monthinchlast_year_months:#define Date_list last year plus last year's every monthDate_list ='%s-%s'%(Last_year, Last_year_month)#get a list of last year through the function appenddata_list_lasts.append (date_list) data_list_todays= []#get a list of this year's time clip month through A for loop#go through the list of the months of the year forToday_year_monthinchtoday_year_months:#define Date_list last year plus this year's every monthData_list ='%s-%s'%(Today_year, Today_year_month)#get a list of this year through the function appenddata_list_todays.append (data_list)#last year's time data plus this year's time data get the month time listData_year_month = data_list_lasts +Data_list_todaysdata_year_month.reverse ()
Program run process picture
Python Gets the data for the previous 12 months, and Python gets the data for the year before the current time,