hello friends,
i am using the os.path.walk to search to filter the files with the given word, this function i m using in many modules. i just want to place this function in some class and call it whenever required by passing the necessary word. for e.g i want to filter files with "Spec" which is specification documents and store in some list, and other time with word "doc" like this many times...so i want to place it in some class placed in some file and access it by calling the function with the filtering word required, like spec, doc etc.... can any one say me how to pass this filtering word to the calling function from os.path.walk...
here is some sample code which i use to filter the documents with spec:
def finddocfiles(option,dir,files):
for index in files:
#print index
if index.rfind("Spec")!=-1:
# all spec files are stored in list_Sharedfiles list
option.append(dir+os.sep+index)
this is called by os.path.walk(path,finddocfiles,list_files)
so i use this very frequently to filter files, so any one please suggest me how to pass the filtering word i.e here "Spec" or "doc" waiting for ur reply...thans in advance