Code to recognize MS-Word document files?

Grant Edwards grante at visi.com
Tue Mar 4 11:59:40 EST 2003


In article <b42lj9$b2q$05$2 at news.t-online.com>, Martin v. Löwis wrote:

>> I'm looking for a snippet of python that I can use to determine
>> if a file is a MS-Word document.
> 
> The GNU file command can do this recognition, atleast partially.

I should have though of that!

> I'm not aware of a Python wrapper around it, but it shouldn't
> be too difficult.

The code needs to run on a win32 platform, but I can probably
glean enough information from /usr/share/magic to figure it
out.

> GNU file will report MS-Word files as "Microsoft Office Document". 
> Whether it is possible to infer them as "Word", I don't know.

Almost all of the "Office" documents that I receive are from
word, so it's good enough for a first order solution.

-- 
Grant Edwards                   grante             Yow!  .. my NOSE is NUMB!
                                  at               
                               visi.com            




More information about the Python-list mailing list