Preparing git repo for final project
This commit is contained in:
22
problems/pset1/extensions/extensions.py
Normal file
22
problems/pset1/extensions/extensions.py
Normal file
@@ -0,0 +1,22 @@
|
||||
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()
|
Reference in New Issue
Block a user