Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pathlib import Path
- def all_file_type(dir_path: str, file_ext: str) -> list:
- """Returns list of all files within dir with specified filetype
- arg 1 dir path, arg 2 : file ext"""
- str_path = Path(dir_path).glob(f"*{file_ext}")
- files = [i for i in str_path]
- return files
Advertisement
Add Comment
Please, Sign In to add comment