|
From: Jorge T. <jt...@te...> - 2001-03-23 15:06:15
|
In Python 2.0 the following code writes a binary file.
original =3D 48565078965739
twobis =3D 256l
a =3D []
f =3D open('c:\\code.gz','w')
try:
while original > 0:
original, binary =3D divmod(original, twobis)
a.insert(0, (chr(binary)))
for c in a:
f.write(c)
finally:
f.close()
In Python this file is written correctly , but when we tried the same =
code in Jython 2.0 the code did not do the job.
The problem we found was an incompatibility writting the binary file, in =
Python is allowed to write the code:
f =3D open('c:\\code.gz','w') or f =3D open('c:\\code.gz','wb')=20
While in Jython only the second option is valid.
Greetings
Jorge Tellez
jt...@te...
|