Re: creating a hex value

2005-06-02 Thread Peter Otten
John Machin wrote: delim = chr(0x15) Ooooh -- a function with a constant arg; I wonder what that evaluates to? chr(0x15) '\x15' Shsh. OK, let's double-check that: chr(0x15) 'The argument is constant -- but not necessarily the /function/.' Shsh :-) Peter --

Re: creating a hex value

2005-06-02 Thread Fredrik Lundh
David Bear wrote: I have a file that I need to parse. Items in it are delimited by a hex 15 (0x015). I know it must be trivial to assign a hex value to a variable but I'm not seeing it in my python essential ref. how can I do delim = 0x15 while: ln = file.read() if ln[0] ==

creating a hex value

2005-06-01 Thread David Bear
I have a file that I need to parse. Items in it are delimited by a hex 15 (0x015). I know it must be trivial to assign a hex value to a variable but I'm not seeing it in my python essential ref. how can I do delim = 0x15 while: ln = file.read() if ln[0] == delim:

Re: creating a hex value

2005-06-01 Thread Paul Rubin
David Bear [EMAIL PROTECTED] writes: I'm not seeing it in my python essential ref. how can I do delim = 0x15 delim = chr(0x15) -- http://mail.python.org/mailman/listinfo/python-list

Re: creating a hex value

2005-06-01 Thread [EMAIL PROTECTED]
What about [EMAIL PROTECTED]:~$ python Python 2.3.5 (#2, May 4 2005, 08:51:39) [GCC 3.3.5 (Debian 1:3.3.5-12)] on linux2 Type help, copyright, credits or license for more information. hex(21) '0x15' -- http://mail.python.org/mailman/listinfo/python-list

Re: creating a hex value

2005-06-01 Thread John Machin
Paul Rubin wrote: David Bear [EMAIL PROTECTED] writes: I'm not seeing it in my python essential ref. how can I do delim = 0x15 delim = chr(0x15) Ooooh -- a function with a constant arg; I wonder what that evaluates to? chr(0x15) '\x15' Shsh. --

Re: creating a hex value

2005-06-01 Thread John Machin
[EMAIL PROTECTED] wrote: What about [EMAIL PROTECTED]:~$ python Python 2.3.5 (#2, May 4 2005, 08:51:39) [GCC 3.3.5 (Debian 1:3.3.5-12)] on linux2 Type help, copyright, credits or license for more information. hex(21) '0x15' len('0x15') 4 Quadruple sheesh. --