I was trying to copy an image with the path : userDATA\user1\profile_image, but unfortunaly, I don`t know the file extention, because the user can drop his own image, so that the suffix is sometimes different.
file_path = drop_image_instance.image_path # the path looks like this: C:\user\images\download1.png
copyfile(file_path, "userDATA\\" + username + "\\profile_image")
My question is, how can I find out, which suffix the file has, or how can i detect the ending in file_path? For example:
def find_suffix(path):
file_ending = path[1]
return file_ending
Thanks for answers!