i am stuck at this rather obvious problem but i can't find a solution. I have a path and I want to list only the directories of the path (and not the subdirectories or file)
for example: my path have directories A B C ; I want to get A B C (i don't care what's inside of them)
i tried this, but this gets me also the subdirectories
from pathlib import Path
def extract_jobs(path):
p = Path(path).glob("**/")
files = [x for x in p if x.is_dir()]
return files
is there an easy way to do it i am missing here? thanks in advance