Advertisement
Guest User

extensions.pz

a guest
Oct 25th, 2023
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | Help | 0 0
  1. name = input("File name: ")
  2. namef = (name.lower()).strip()
  3. lst = namef.split(".")
  4. ext = "." + lst[-1]
  5. match ext:
  6.     case ".gif" | ".png":
  7.         print(f"image/{ext.strip(".")}")
  8.     case ".jpg" | ".jpeg":
  9.         print("image/jpeg")
  10.     case ".pdf" | ".zip":
  11.         print(f"application/{ext.strip(".")}")
  12.     case ".txt":
  13.         print("text/plain")
  14.     case _:
  15.         print("application/octet-stream")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement