In article <[email protected]>,
Lloyd Zusman  <[email protected]> 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 ([email protected])           <*>         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

Reply via email to