Hello Dominique, On Sat, Apr 4, 2009 at 6:07 AM, Dominique <[email protected]> wrote: > 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.
First of all, I doubt if reading a file in text format would cause any harm. Writing may screw things up. Secondly, determining the type of file is based on heuristics and most often determined by reading a chunck of the file. I found the following recipe, that could be useful to you: http://code.activestate.com/recipes/173220/ -- Senthil _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
