Re: [Tutor] question about ord

2005-11-15 Thread nephish
Thanks for all your help and the link, looking at the docs right now. slaute` shawn On Wed, 2005-11-16 at 10:05 +1300, Liam Clarke-Hutchinson wrote: > Hmm, > > Never thought of doing it that way. > > try - > > import struct > > a = theByte > value = ord(a) > theByteReloaded = struct.pack("i

Re: [Tutor] question about ord

2005-11-15 Thread Python
chr(value) >>> chr(ord('a')) == 'a' True On Tue, 2005-11-15 at 14:46 -0600, nephish wrote: > Hey there, > i am using a script to change a byte into an integer > like this: > a = the byte > value = ord(a) > > but i cant find the operation that can change it back to a byte. > i am

Re: [Tutor] question about ord

2005-11-15 Thread Liam Clarke-Hutchinson
Hmm, Never thought of doing it that way. try - import struct a = theByte value = ord(a) theByteReloaded = struct.pack("i",value) You nmay want to check the docs for the struct module at python.org on that pattern. Liam Clarke-Hutchinson -Original Message- From: [EMAIL PROTECTED]

Re: [Tutor] question about ord

2005-11-15 Thread Kent Johnson
nephish wrote: > Hey there, > i am using a script to change a byte into an integer > like this: > a = the byte > value = ord(a) > > but i cant find the operation that can change it back to a byte. chr() See http://docs.python.org/lib/built-in-funcs.html Kent -- http://www.ke