Solved: Content-Type Guesser
Thomas Guettler
zopestoller at thomas-guettler.de
Wed Jul 24 11:33:07 EDT 2002
Walter Dörwald wrote:
> Thomas Guettler wrote:
>
>> Hi!
>>
>> Has someone a function for guessing the content type
>> given a filename?
>>
>> foo.xml --> text/xml
>> foo.html --> text/html
>> ....
>>
>> It should work for the most common file-extensions
>
>
> Python 2.2.1 (#1, Apr 10 2002, 19:08:12)
> [GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-98)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import mimetypes
> >>> help(mimetypes.guess_type)
> Help on function guess_type in module mimetypes:
> ...
Thank you very much!
thomas
More information about the Python-list
mailing list