<br><br><div class="gmail_quote">On Tue, Mar 31, 2009 at 12:23 PM, ritu <span dir="ltr"><<a href="mailto:ritu_bhandari27@yahoo.com">ritu_bhandari27@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
I'm wondering if Python has a utility to detect binary content in<br>
files? Or if anyone has any ideas on how that can be accomplished? I<br>
haven't been able to find any useful information to accomplish this<br>
(my other option is to fire off a perl script from within m python<br>
script that will tell me whether the file is binary), so any pointers<br>
will be appreciated.<br>
</blockquote><div><br><br>All files are binary. The question is whether every byte in the file represents a (whole or part of a) character or whether some of the data represents a different data type. You could theoretically have a "binary" file that appears in a text editor to be perfect English. How does your perl script tell the difference?<br>
<br><br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><font color="#888888">
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></blockquote></div><br>