I have a directory full of files of several different types (.fits, .jpg, .txt, etc.). I want to create a list that contains strings of only all the .fits filenames in the directory. Is there a convenient way to write this in Python?
Asked
Active
Viewed 47 times
0
-
Does this answer your question? [How to write "or" in a glob() pattern?](https://stackoverflow.com/questions/69298452/how-to-write-or-in-a-glob-pattern) – Timur Shtatland Jun 22 '22 at 16:43
-
1`files = pathlib.Path(yourpathnamehere).glob('*.fits')`...? – Matthias Jun 22 '22 at 16:44