human
Find all files in directory with extension .txt
assistant
Here is some code to find all files in directory "/mydir" with extension ".txt"

for file in os.listdir('/mydir'):
    if file.endswith('.txt'):
        pass

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.