how to iterate through files in a folder python code example
Example 1: python iterate through files in directory
import os
for filename in os.listdir(directory):
if filename.endswith(".asm") or filename.endswith(".py"):
continue
else:
continue
Example 2: how to iterate through files in a folder python
import os
directory = 'the/directory/you/want/to/use'
for filename in os.listdir(directory):
if filename.endswith(".txt"):
continue
else:
continue
Example 3: how to iterate through files in a folder python
import os
for filename in os.listdir(directory):
if filename.endswith(".asm") or filename.endswith(".py"):
continue
else:
continue
Example 4: how to iterate through files in a folder python
import os
for filename in os.listdir(directory):
if filename.endswith(".asm") or filename.endswith(".py"):
continue
else:
continue