chr / ord

Sean McIlroy sean_mcilroy at yahoo.com
Mon Nov 2 23:30:00 EST 2009


hello

how do i say "chr" and "ord" in the new python? the functions below
(which work in 2.6.6) 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]))



More information about the Python-list mailing list