Re: chr / ord

2009-11-03 Thread Sean McIlroy
thanks. that did the trick. in case anyone else is in the same boat as myself, here are the relevant correspondences: string <-> [int] bytes <-> [int] --- -- lambda string: [ord(x) for x in string] list lambda ints: ''.join([chr(x

Re: chr / ord

2009-11-02 Thread Steven D'Aprano
On Mon, 02 Nov 2009 20:30:00 -0800, Sean McIlroy wrote: > hello > > 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 get. There is no Python 2.6.6. The lates

Re: chr / ord

2009-11-02 Thread Ben Finney
Sean McIlroy writes: > how do i say "chr" and "ord" in the new python? By “the new python”, what do you mean? * Python 2.6.4, the newest released version. * Python 2.7, a currently in-development version. * Python 3.1, another new release (but not the latest). * Python 3.2, a currently in-devel

Re: chr / ord

2009-11-02 Thread Benjamin Kaplan
On Mon, Nov 2, 2009 at 11:30 PM, Sean McIlroy wrote: > 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()] >

chr / ord

2009-11-02 Thread Sean McIlroy
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(''.