File Headers

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

"Austin" <newwave at> wrote in message
news:wjfU6.47832$V5.846183 at
> 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
> If it's neither, then it should return something along those lines.
> Please e-mail me directly at (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 ...


More information about the Python-list mailing list