Python get a list of years -
i need last 5 years in python. hoping in once nice neat line. best can come this.
year = datetime.datetime.today().year years = [year, year-1, year-2, year-3, year-4, year-5]
is there nicer way?
this can help:
>>> range(year, year - 6, -1) [2016, 2015, 2014, 2013, 2012, 2011]
Comments
Post a Comment