getting mimetype of a file
Christos TZOTZIOY Georgiou
tzot at sil-tec.gr
Wed Jun 2 15:21:18 CEST 2004
On Wed, 02 Jun 2004 08:52:20 GMT, rumours say that Matteo Merli
<matteo.merli at studenti.unipr_punto_it> might have written:
>Christos TZOTZIOY Georgiou wrote:
>>>> is there any way to determine the mimetype of a file using ruby?
>>>=P just realized I sent this to the wrong list. as long as I'm here... how
>>>is it done in python?
>> The mimetypes.py module in the standard library is your friend.
...if one wants to judge by the filename only (I wasn't clear earlier).
>A more effective approach would be to use the "magic" module that come
>with the "file" utility (it is present in the sources, but not built by
>This way you can perform a fine-grained recognition of files..
Indeed. One such attempt (mine) to use the "magic" file from python can
be found here:
TZOTZIOY, I speak England very best,
"I have a cunning plan, m'lord" --Sean Bean as Odysseus/Ulysses
More information about the Python-list