Determine file type (binary or text)
Graham Fawcett
fawcett at teksavvy.com
Wed Aug 13 21:03:06 EDT 2003
John Machin wrote:
>Graham Fawcett <fawcett at teksavvy.com> wrote in message news:<mailman.1060799361.14244.python-list at python.org>...
>
>
>>It is trivial to create a non-text file that has no NULs.
>>
>> f = open('no_zeroes.bin', 'rb')
>> for x in range(1, 256):
>> f.write(chr(x))
>> f.close()
>>
>>
>
>I tried this but it didn't work. It said:
>
>IOError: [Errno 2] No such file or directory: 'no_zeroes.bin'.
>
>So I thought I had to be persistent but after doing it a few more times it said:
>
>SerialIdiotError: What I tell you three times is true.
>NotLispingError: You need 'wb' as in 'wascally wabbit'
>
>This is very strange behaviour -- does my computer have worms?
>
>
No, but my brain does. Glad you caught my typo.
However, it looks like your computer definitely has an AttitudeError!
-- Graham
More information about the Python-list
mailing list