Skip to content

Commit ab29bfa

Browse files
committed
use the dict for the extensions
1 parent 4669912 commit ab29bfa

File tree

2 files changed

+0
-25
lines changed

2 files changed

+0
-25
lines changed

pset1/extensions.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,3 @@
1-
filename=input ('File: ').lower().strip()
2-
3-
dot=filename.rfind('.')
4-
5-
filetype=filename[dot:]
6-
7-
if filetype == '.jpg' or filetype == '.jpeg':
8-
print('image/jpeg')
9-
elif filetype == '.gif':
10-
print('image/gif')
11-
elif filetype == '.png':
12-
print('image/png')
13-
elif filetype == '.pdf':
14-
print('application/pdf')
15-
elif filetype == '.txt':
16-
print('text/plain')
17-
elif filetype == '.zip':
18-
print('application/zip')
19-
else :
20-
print('application/octet-stream')
21-
22-
23-
24-
# this method is easier and allows a broader list instead of if-else everything.
251
types = {
262
"gif": "image/gif",
273
"jpg": "image/jpeg",

pset3/outdated.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
except:
4040
pass
4141

42-
# error here, fixed it.
4342
if date_type == 1:
4443
month_no = str(month.index(date[0])+1)
4544
print(date[2].zfill(4), month_no.zfill(2), date[1].zfill(2), sep='-')

0 commit comments

Comments
 (0)