Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #19407

Find the mime type of a file.

From Olive <diolu@bigfoot.com>
Newsgroups comp.lang.python
Subject Find the mime type of a file.
Date 2012-01-25 18:04 +0100
Organization Aioe.org NNTP Server
Message-ID <20120125180432.76079215@bigfoot.com> (permalink)

Show all headers | View raw


I want to have a list of all the images in a directory. To do so I want
to have a function that find the mime type of a file. I have found
mimetypes.guess_type but it only works by examining the extension. In
GNU/Linux the "file" utility do much better by actually looking at the
file. Is there an equivalent function in python (as a last resort I can
always use the external file utility).

Olive

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Find the mime type of a file. Olive <diolu@bigfoot.com> - 2012-01-25 18:04 +0100
  Re: Find the mime type of a file. Chris Rebert <clp2@rebertia.com> - 2012-01-25 09:40 -0800
  Re: Find the mime type of a file. Jon Clements <joncle@googlemail.com> - 2012-01-25 16:12 -0800

csiph-web