I am running the following code :
foldarz = [ f.path for f in os.scandir('.') if f.is_dir() ] print(foldarz) This prints the folder name correctly, but with a prepended ".\". I don't want the ".\".
I know I can split the string etc, but I assume there's a better way without having to call another function.
os.path.basename(f)instead off.path.f.path[2:]orf.path[3:]? Orf.name? ... docs.python.org/3/library/os.html#os.DirEntry.namef.nameworks for me, maybe I misread the problem.