How to check if a file is a textfile?

Posted by daniels on Stack Overflow See other posts from Stack Overflow or by daniels
Published on 2010-03-18T17:56:19Z Indexed on 2010/03/18 18:01 UTC
Read the original article Hit count: 162

Filed under:

I have a folder full of files and i want to search some string inside them. The issue is that some files may be zip,exe,ogg,etc.
Can i check somehow what kind of file is it so i only open and search through txt, php, etc files. I can't rely on the file extension.

© Stack Overflow or respective owner

Related posts about python