Actually, this can be done using the glob
library using glob.glob:
path = 'img-0*.png'
def is_globable(path):
return bool(glob.glob(path))
if os.path.isfile(path):
pass
elif is_globable(path):
pass
else:
raise Exception(...)
Here are the docs:
https://docs.python.org/3/library/glob.html (first thing)