In article <mailman.2434.1265983307.28905.python-l...@python.org>, Lloyd Zusman <l...@asfast.com> wrote: > >Perl has the following constructs to check whether a file is considered >to contain "text" or "binary" data: > >if (-T $filename) { print "file contains 'text' characters\n"; } >if (-B $filename) { print "file contains 'binary' characters\n"; }
Assuming you're on a Unix-like system or can install Cygwin, the standard response is to use the "file" command. It's *much* more sophisticated. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "At Resolver we've found it useful to short-circuit any doubt and just refer to comments in code as 'lies'. :-)" -- http://mail.python.org/mailman/listinfo/python-list