path = "xlsx_files/risk_on/feature/US10Y.csv" name = path.split("/") print(name) #['xlsx_files', 'risk_on', 'feature', 'US10Y.csv']