Unix filename wildcards in Python?
问题 How do Unix filename wildcards work from Python ? A given directory contains only subdirectories, in each of which there is (among others) one file whose name ends with a known string, say _ext . The first part of the filename always varies, so I need to get to the file by using this pattern. I wanted to do this: directory = "." listofSubDirs = [x[0] for x in os.walk(directory)] listofSubDirs = listofSubDirs[1:] #removing "." for subDirectory in listofSubDirs: fileNameToPickle = subDirectory