[Python-ideas] os.path.isbinary
Terry Reedy
tjreedy at udel.edu
Wed Jul 31 18:37:45 CEST 2013
On 7/31/2013 11:40 AM, Ryan wrote:
> Here's something more interesting than my shlex idea.
>
> os.path is, pretty much, the Python FS toolbox, along with shutil. But,
> there's one feature missing: check if a file is binary. It isn't hard,
> see http://code.activestate.com/recipes/173220/. But, writing 50 lines
> of code for a more common task isn't really Python-ish.
The somewhat arbitrarily defined is(ascii)textfile function and
subsidiaries is more like 13 lines. The best discrimination function is
heavily dependent upon the two groups of files one expects to be testing.
--
Terry Jan Reedy
More information about the Python-ideas
mailing list