23 lines
505 B
Python
23 lines
505 B
Python
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()
|