I am trying to list only text files in a directory (files with .txt extension). I got as far as listing only files and ignore directories but I am stuck.
from os import listdir
print(f for f in os.listdir('/home') if path.isfile(f))
How to list only the text files?