2

I have a little problem, that I want to check the end of output(string) but inside of a match statement in python, I will show my example to clear the idea:


def main  ():
    File = input("File Name:")
    extension_check(File)

def extension_check(n):
    match n:
        case ".gif" :
            print("File extension is : Image/Gif")
        case ".jpg" | ".jpeg":
            print("File extension is : Image ")
        case ".png":
            print("File extension is : Image/PNG")
        case ".pdf":
            print("File extension is : Text on App PDF")
        case ".txt":
            print("File extension is : text/plain")
        case ".zip":
            print("File extension is : application/zip")
        case _:
            print("application/octet-stream")
        


main()

I already use the endwwith() at the top of the match statement but they

0 Answers0