What about something like this:

https://github.com/ahupp/python-magic

And, I explained the joke in my last post.

Steven D'Aprano <steve@pearwood.info> wrote:
On 01/08/13 10:25, Ryan wrote:
I just realized I misexpressed myself...again. I meant ASCII or binary, not text or binary. Kind of like the old FTP programs. The implementation would determine if it was ASCII or binary.

Still can't be done reliably, but even if it could, what's so special about ASCII? Should we have dozens of such functions?

isascii
isbig5
iskoi8u
iskoi8r

and so on?


The concept of "isbinary" is fundamentally flawed. The concept of "try to guess what sort of data a file might plausibly contain" is not flawed, but is a much, much bigger problem than is suitable for a simple os.path function.


--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.