chr / ord
steve at REMOVE-THIS-cybersource.com.au
Tue Nov 3 06:24:54 CET 2009
On Mon, 02 Nov 2009 20:30:00 -0800, Sean McIlroy wrote:
> how do i say "chr" and "ord" in the new python?
"chr" and "ord".
> the functions below (which work in 2.6.6)
Can I borrow your time machine, there's some lottery numbers I want to
There is no Python 2.6.6. The latest version of 2.6 is 2.6.4.
> show what i'm trying to do. thanks if you can help.
> def readbytes(filepath):
> return [ord(x) for x in open(filepath,'rb').read()]
> def writebytes(numbers,filepath):
> open(filepath,'wb').write(''.join([chr(x) for x in numbers]))
Have you tried them in "the new Python" (whatever that is...)? What do
they do that isn't what you expect?
More information about the Python-list