I am working on a code that searches a folder gets a specific part of the file name and adds 1 to a file counter. There are some files in tehre that have a special character that indicates that is is only half. I ahve got it to count the full ones but can not figure out a way to get the half ones to count. The special character that is in the names to inficate half is H. If someone could please help me figure this out it would help increase my production time.
def bedCount(pathname, bednumber): filecount = 0 for file in os.listdir(pathname): if fnmatch.fnmatch (file, ''+bednumber+''): filecount = filecount+1 return filecount countbeds=bedCount(filestart, 'B') print countbeds