PDA

View Full Version : (python) mime-type



dabear
April 4th, 2006, 12:31 AM
Hi, I want to find out weather or not a file really is an iso file. How do I do that?
Checking the extension isn't hard, but I really would like to check if the contents of a file is what the file extension claims. Any idea?

pranith
April 4th, 2006, 04:31 AM
hi,
there is a command calles file in unix that does the job for u.... It tells the type of the file by probing some of the contents.
all u need to do is
import os
os.system("file "+$filename)

hope that helps
pranith.