I want to ignore a specific file while using os.walk(path)
to iterlate the subTree in the directory.
But for some reason, there is some file I am not expect to parse. e.g. the .git
file which includes lots of documents. How can I do this?
file_to_ignore = '.git'
for dirname, dirnames, filenames in os.walk(path):
for filename in filenames:
if filename == file_to_ignore: continue
else:
#do somthing