How to know if a file is a text file

Nobody nobody at nowhere.com
Sun Nov 15 13:06:48 CET 2009


On Sat, 14 Nov 2009 17:02:29 +0100, Luca Fabbri wrote:

> I'm looking for a way to be able to load a generic file from the
> system and understand if he is plain text.
> The mimetype module has some nice methods, but for example it's not
> working for file without extension.
> 
> Any suggestion?

You could use the "file" command. It's normally installed by default on
Unix systems, but you can get a Windows version from:

	http://gnuwin32.sourceforge.net/packages/file.htm




More information about the Python-list mailing list