I am trying to read multiple folders for a specific text file using glob.glob
to search in all folders. I wanted to print only the folder name instead of folder name/file.txt.
with open ('input.txt', 'w') as i:
for files in glob.glob ('*/*.txt'):
print (files)
I want my output to be like
folder1
folder2
folder3
instead of
folder1/file.txt
folder2/file2.txt
I saw many posts where they used os.path....which I did understand clearly