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

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -