On Sat, Apr 4, 2009 at 7:07 AM, Dominique <[email protected]> wrote:
> Hello,
>
> I am developing a very small multi-platform app to search for a specific word 
> or
> expression in files located in a drive or directory.
> So I need to open files to search for the word.
>
> I read that opening a binary file as a text file (open(filename, 'r')) may
> corrupt the file.
> Consequently, before opening the file, I'd like to test it to adapt the 
> opening
> mode ('r' or 'rb').
>
> Is there a way to make the difference between binary and text files ?

You might want to look at grin which has full-featured recursive
search including identifying binary files:
http://pypi.python.org/pypi/grin

Kent
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to