Answers for "how to iterate through all test files in a directory python"

17

iterate through all files in directory python

import os
directory = 'the/directory/you/want/to/use'

for filename in os.listdir(directory):
    if filename.endswith(".txt"):
      #do smth
      continue
    else:
    continue
Posted by: Guest on March-30-2020

Code answers related to "how to iterate through all test files in a directory python"

Python Answers by Framework

Browse Popular Code Answers by Language