File Headers

Todd Smith todd at designsouth.net
Fri Jun 8 23:17:34 EDT 2001


"Austin" <newwave at ACMEmail.MeNoLikeSpam.net> wrote in message
news:wjfU6.47832$V5.846183 at typhoon.columbus.rr.com...
> Hello All,
>
> I would like to be able to have a user specify a document and have the
> program return the files type. This cannot be determined via extension,
> however it only needs to be able to distinguish between a MP3 or a Zip
file.
> If it's neither, then it should return something along those lines.
>
> Please e-mail me directly at newwave@@@acmemail.net (remove the extra @
> signs) as I have limited access to newsgroups. Thanks!!!
>

use the unix command "file"

$file_info = system "file", "$file";

but of course there's lots of security problems when you rely on outside
programs ...

-todd





More information about the Python-list mailing list