Lets say you have some path PythonProjectsome_image
but you don’t know the file extensions, since it’s a photo that could be any type (.png
, .jpg
, etc.)
So, how would you get the file extension with just the path? Is that even possible?
I’ve tried using the pathlib module, but without actually giving a file extension when creating a Path object, it doesn’t give a suffix. You can’t open a file without a file extension, either.