Skip to content

Commit 74cdfc4

Browse files
committed
python files commit
1 parent 5b8d728 commit 74cdfc4

2 files changed

Lines changed: 445 additions & 0 deletions

File tree

file_ext.py

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Testing dictionary iteration
2+
3+
file_extensions = {
4+
"documents": {
5+
".doc": "Microsoft Word",
6+
".docx": "Microsoft Word (XML)",
7+
".pdf": "Portable Document Format",
8+
".txt": "Plain Text",
9+
".rtf": "Rich Text Format",
10+
".odt": "OpenDocument Text"
11+
},
12+
"spreadsheets": {
13+
".xls": "Microsoft Excel",
14+
".xlsx": "Microsoft Excel (XML)",
15+
".csv": "Comma-Separated Values",
16+
".ods": "OpenDocument Spreadsheet"
17+
},
18+
"presentations": {
19+
".ppt": "Microsoft PowerPoint",
20+
".pptx": "Microsoft PowerPoint (XML)",
21+
".odp": "OpenDocument Presentation"
22+
},
23+
"archives": {
24+
".zip": "ZIP Archive",
25+
".rar": "RAR Archive",
26+
".7z": "7-Zip Archive",
27+
".tar": "Unix Archive",
28+
".gz": "Gzip Compressed Archive"
29+
},
30+
"code": {
31+
".py": "Python Script",
32+
".js": "JavaScript",
33+
".html": "HyperText Markup Language",
34+
".htm": "HyperText Markup Language",
35+
".css": "Cascading Style Sheets",
36+
".java": "Java Source Code",
37+
".c": "C Source Code",
38+
".cpp": "C++ Source Code"
39+
},
40+
"system": {
41+
".exe": "Windows Executable",
42+
".dll": "Dynamic Link Library",
43+
".sys": "System File",
44+
".bat": "Batch File",
45+
".sh": "Shell Script"
46+
},
47+
"data": {
48+
".json": "JavaScript Object Notation",
49+
".xml": "Extensible Markup Language",
50+
".sql": "SQL Script",
51+
".db": "Database File",
52+
".sqlite": "SQLite Database"
53+
},
54+
"images": {
55+
".jpg": "JPEG Image",
56+
".jpeg": "JPEG Image",
57+
".png": "Portable Network Graphics",
58+
".gif": "Graphics Interchange Format",
59+
".bmp": "Bitmap Image",
60+
".tiff": "Tagged Image File Format",
61+
".tif": "Tagged Image File Format",
62+
".webp": "Web Picture Format",
63+
".svg": "Scalable Vector Graphics",
64+
".heic": "High Efficiency Image Format",
65+
".heif": "High Efficiency Image Format",
66+
".raw": "Raw Image Format",
67+
".ico": "Icon File"
68+
},
69+
"audio": {
70+
".mp3": "MPEG Audio Layer III",
71+
".wav": "Waveform Audio File",
72+
".aac": "Advanced Audio Coding",
73+
".flac": "Free Lossless Audio Codec",
74+
".ogg": "Ogg Vorbis",
75+
".wma": "Windows Media Audio",
76+
".m4a": "MPEG-4 Audio",
77+
".aiff": "Audio Interchange File Format",
78+
".alac": "Apple Lossless Audio Codec",
79+
".opus": "Opus Audio Codec"
80+
},
81+
"video": {
82+
".mp4": "MPEG-4 Video",
83+
".avi": "Audio Video Interleave",
84+
".mov": "QuickTime Movie",
85+
".wmv": "Windows Media Video",
86+
".mkv": "Matroska Video",
87+
".flv": "Flash Video",
88+
".webm": "Web Media",
89+
".3gp": "3GPP Multimedia",
90+
".m4v": "MPEG-4 Video",
91+
".ts": "Transport Stream"
92+
}
93+
}
94+
95+
96+
def main():
97+
...
98+
99+
100+
101+
# def identify_extension(b):
102+
# # b = unknown extension
103+
# for category, category_dict in file_extensions.items():
104+
# for extn, extn_info in category_dict.items():
105+
# if extn == b:
106+
# return extn, extn_info, category
107+
108+
# return f"Extension not found"
109+
110+
111+
112+
113+
if __name__ == "__main__":
114+
main()

0 commit comments

Comments
 (0)