get Windows file type

dwelch donald.welch at hp.com
Mon May 8 18:14:48 CEST 2006


BartlebyScrivener wrote:
> Using Python on Windows XP, I am able to get almost all file and path
> info using os.path or stat, but I don't see a way to retrieve the file
> type? E.g. Microsoft Word file, HTML file, etc, the equivalent of what
> is listed in the "Type" column in the Windows Explorer box.
> 
> Thanks,
> 
> rick
> 
This worked well for me on Linux, should work on Windows:

http://www.demonseed.net/~jp/code/magic.py

-Don



More information about the Python-list mailing list