File type X45315


Statement
 

pdf   zip

html

Design a function extensions(lfich) which, given a list of filenames lfich, returns a dictionary that associates each type of file (its extension) with the list of the filenames of that type.

Sample session
>>> f = ['carta.txt', 'resum.docx', 'viva_la_vida.mp3', 'podcast1.mp4',
...      'perfil.jpeg', 'doc.txt', 'som_foc.mp3', 'a.b.txt']
>>> d = extensions(f)
>>> d == {'txt': ['carta', 'doc', 'a.b'],
...       'docx': ['resum'],
...       'mp3':['viva_la_vida', 'som_foc'],
...       'mp4': ['podcast1'], 'jpeg': ['perfil']}
True
Information
Author
InfBesos
Language
English
Translator
Original language
Spanish
Other languages
Catalan Spanish
Official solutions
Python
User solutions
Python