I have 47 folders (100, 00, 01, 02, ..., 43, 44, 45). I want to store the name of these folders inside a list so that I can build a pandas Dataframe with it. So far, I have this code:
import os
import glob
path = '/content/drive/MyDrive/data/classes/'
ListOfClasses = []
for file in glob.glob (path + '/*'):
ListOfClasses.append(file)
ListOfClasses
However, the names of the folders come out like this (They also come unorganized):
['/content/drive/MyDrive/data/classes/42',
'/content/drive/MyDrive/data/classes/43',
'/content/drive/MyDrive/data/classes/36',
'/content/drive/MyDrive/data/classes/45',
...,
'/content/drive/MyDrive/data/classes/00',
'/content/drive/MyDrive/data/classes/02',
'/content/drive/MyDrive/data/classes/04']
How can I transform the previous way into this:
['00',
'01',
'02',
'03',
...,
'44',
'45',
'100']