Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- name = input("File name: ")
- namef = (name.lower()).strip()
- lst = namef.split(".")
- ext = "." + lst[-1]
- match ext:
- case ".gif" | ".png":
- print(f"image/{ext.strip(".")}")
- case ".jpg" | ".jpeg":
- print("image/jpeg")
- case ".pdf" | ".zip":
- print(f"application/{ext.strip(".")}")
- case ".txt":
- print("text/plain")
- case _:
- print("application/octet-stream")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement