I am trawling through a storage area and the paths look a lot like this: storagearea/storage1/ABC/ABCDEF1/raw/2013/05/ABCFGM1
I wont always know what year is it. I need to find the starting index position of the year
Therefor I am looking for where I find the following in the file name (2010, 2011, 2012, 2013, 2014 etc...)
I have set up a list as follows:
list_ = ['2010', '2011','2012','2013','2014', '2015', '2016']
and I can find if it is in the file name
if any(word in file for word in list_):
print 'Yahooo'
But how do I find the character index of the year in the absolute path?