I have the following python list:
['chhattisgarh_2015_aa.csv', 'chhattisgarh_2016_aa.csv', 'daman_and_diu_2000_aa.csv', 'daman_and_diu_2001_aa.csv', 'daman_and_diu_2002_aa.csv']
How do I separate it into 2 lists:
['chhattisgarh_2015_aa.csv', 'chhattisgarh_2016_aa.csv'] and ['daman_and_diu_2000_aa.csv', 'daman_and_diu_2001_aa.csv', 'daman_and_diu_2002_aa.csv']
The lists are split based on the words preceeding the year i.e. 2000...
I know I should use regex in python but not sure how to do it. Also, the solution needs to be extensible and not dependent on actual names e.g. chattisgarh
Aucun commentaire:
Enregistrer un commentaire