files.py 276 B

12345678910
  1. from os import listdir, getcwd
  2. from os.path import isfile, join, basename
  3. def get_txt_files():
  4. path = getcwd() + "/files"
  5. try:
  6. onlyfiles = [f"{path}/{f}" for f in listdir(path) if isfile(join(path, f)) and f.endswith('txt')]
  7. except:
  8. return []
  9. return onlyfiles