getting mimetype of a file

Matteo Merli matteo.merli at studenti.unipr_punto_it
Wed Jun 2 04:52:20 EDT 2004


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.

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..

Matteo



More information about the Python-list mailing list