I am using python to transverse into all sub folders in a directory and in order to write up the os commands. I need a list of all sub folders but the list is returning with the "./" ahead of the folder names and I am looking to remove this sub string from all list itmes simultaneously
My script so far:
import os
import glob
file_list = glob.glob("./*")
file_list.remove("./script.py")
print(file_list)
returns list
['./folder1', './folder2', './folder3', './folder4', './folder5']
I would like
['folder1', 'folder2', 'folder3', 'folder4', 'folder5']