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

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

How to merge four videos on one screen with ffmpeg -

c - getting error: cannot take the address of an rvalue of type 'int' -