I want to take a path from the user and I want to list the file names of all the directories and sub directories in that path. So far, I was only able to get the file names for directories not subdirectories: I'm not allowed to use os.walk()
import sys, os.path
l = []
def fnames(path):
global l
l = os.listdir(path)
print(l)
path = '/Users/sohamphadke/Desktop'
for i in l:
if os.path.isdir(l) == True:
fnames(l)
elif os.path.isdir(l) == False:
break