getting mimetype of a file
Christos TZOTZIOY Georgiou
tzot at sil-tec.gr
Wed Jun 2 09:21:18 EDT 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?
>> [snip]
>>>=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
>default).
>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:
http://www.sil-tec.gr/~tzot/python/
--
TZOTZIOY, I speak England very best,
"I have a cunning plan, m'lord" --Sean Bean as Odysseus/Ulysses
More information about the Python-list
mailing list