Binary or ascii file?
Grant Edwards
ge at nowhere.none
Thu Sep 7 13:50:46 EDT 2000
In article <imefrs4r6svcpk7rsa617ps45u3eepi2hb at 4ax.com>, Anders M Eriksson wrote:
>Working on windows I need to know if the file I'm about to open is
>binary or ascii.
It's whichever you open it as. "Binary vs. ASCII" mode is
determined by the method the program uses to handle the data in
the file. A file itself isn't either one, it's just a stream of
bytes.
>How can I find out which the file is?
It's either -- or both, depending on how you want to look at
it. If you want the data treated as ASCII and CR/LF
translation done, then open it in ASCII mode. If you want the
bytes exactly as they are, open it in binary mode.
--
Grant Edwards grante Yow! HELLO, everybody,
at I'm a HUMAN!!
visi.com
More information about the Python-list
mailing list