12345678910111213 |
- from os import listdir, getcwd
- from os.path import isfile, join, basename
- def get_txt_files():
- path = getcwd() + "/files"
- try:
- onlyfiles = [f"{path}/{f}" for f in listdir(path) if isfile(join(path, f)) \
- and f.lower().endswith('.txt')]
- except Exception as err:
- print(f'files10 ERR \n{err}')
- return []
- return onlyfiles
|