how would i check if all files in specific directory dir/
share the same file ending .txt
.
This is how I find the files:
for dirpath, dirnames, files in os.walk(dir):
print(files)
how would i check if all files in specific directory dir/
share the same file ending .txt
.
This is how I find the files:
for dirpath, dirnames, files in os.walk(dir):
print(files)
all_end_with_txt = True
for dirpath, dirnames, files in os.walk(dir):
for file in files:
if not file.lower().endswith('.txt'):
all_end_with_txt = False