I am using pathlib.Path() to check whether a file exists, and open it as an image using rasterio.
filename = pathlib.Path("./my_file-name.tif")
However, some of the files in the directory I am loading from have a slightly different filename, e.g. my_filename.tif (without a hyphen) or my_file_name.tif (with an underscore instead of a hyphen).
All file names have the same basic structure. Is there a better way to call pathlib.Path() with all possible variations in filename.tif than just checking if they all exist? e.g.,
filename = pathlib.Path("./my_file-name.tif")
if not file.is_file():
file = Path("./my_file_name.tif")
if not file.is_file():
file = Path("./my_filename.tif")