|
From: <bc...@wo...> - 2001-03-27 15:26:14
|
[Jorge Tellez]
>In Python 2.0 the following code writes a binary file.
>
>original = 48565078965739
>twobis = 256l
>a = []
>f = 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 = open('c:\\code.gz','w') or f = open('c:\\code.gz','wb')
>
>While in Jython only the second option is valid.
Right. I have added this difference and an explation for it to the
differences page:
http://www.jython.org/docs/differences.html
regards,
finn
|