Itzik984 Itzik984 - 3 months ago 9
Python Question

How can I iterate over files in a given directory?

I need to iterate through all

.asm
files of a given directory and do some actions on them.

How can this be done in a efficient way?

Answer
for filename in os.listdir(directory):
    if filename.endswith(".asm") or filename.endswith(".py"): 
        # print(os.path.join(directory, filename))
        continue
    else:
        continue