So I’m trying to use glob.glob to to go through a user-given path to Python and then finding all subsequent folders for a .txt. Currently, below, is what I have but it doesn’t seem to work.
fileName = raw_input("> ")
listOfTxt = []
for files in glob.glob(os.path.join(fileName, "\\Folder\\*\\*\\*.txt")):
listOfTxt.append(files) # add it to the list
I’m not sure how to get this to work, or I’m just not understanding the glob.glob with os.path.
If you simply want a list of all
.txtfiles inos.path.join(user_dir,'Folder'), thenos.walkis probably a better way to go: