I am getting invalid syntax on the following:
rootdir = 'c://temp/test//files//'
for subdir, dirs, files in os.walk(rootdir):
for file in files:
fileParts = file.split('.')
if len(fileParts) > 1:
stripper = fileParts([len(fileParts)-2]
print(stripper)
there’s a missing closing parenthesis
), should be:Aside: You might find some of the functions in the os.path module useful, in particular os.path.split() and os.path.splitext(). Should you need to put paths together later, os.path.join() is good to use.