12345678910111213141516171819202122 |
- extensions = {
- ".gif": "image/gif",
- ".jpg": "image/jpeg",
- ".jpeg": "image/jpeg",
- ".png": "image/png",
- ".pdf": "application/pdf",
- ".txt": "text/plain",
- ".zip": "application/zip"
- }
- def main():
- file_name = input("Enter file name:\t\t").lower().strip()
- for extension, mime in extensions.items():
- if file_name.endswith(extension):
- print(mime)
- break
- else:
- print("application/octet-stream")
- if __name__ == "__main__":
- main()
|