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[
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
[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 sheee
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.
--
http://mail.python.
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
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
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:
do