Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (18.4k points)

I have a List :

Old_list =['orders_ce_deduped.01.csv','orders_ce_deduped.02.csv']

I need to get the 01 and 02 part and store that into another list using python

new_list = ['01','02']

1 Answer

0 votes
by (36.8k points)

If your CSV file names are consistent like the example('~~~.number.csv')

this will probably work

new_list = [i.split('.')[1] for i in Old_list]

 If you want to know more about the Data Science then do check out the following Data Science which will help you in understanding Data Science from scratch

Browse Categories

...