<human>:  Find all files in directory with extension .txt
<bot>: Here is some code to find all files in directory "/mydir" with extension ".txt"

for (root, dirs, files) in os.walk('/mydir'):
  for file in files:
    if file.endswith('.txt'):
      pass

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