Re: hex notation funtion

2005-01-18 Thread tertius
tertius wrote: Hi, Is there a builtin function that will enable me to display the hex notation of a given binary string? (example below) Thanks all. -- http://mail.python.org/mailman/listinfo/python-list

Re: hex notation funtion

2005-01-18 Thread Peter Hansen
Grant Edwards wrote: On 2005-01-18, Grant Edwards <[EMAIL PROTECTED]> wrote: On 2005-01-18, tertius <[EMAIL PROTECTED]> wrote: Is there a builtin function that will enable me to display the hex notation of a given binary string? (example below) ' '.join('%02x' % ord(b) for b in s) Oops. Should

Re: hex notation funtion

2005-01-18 Thread Grant Edwards
On 2005-01-18, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2005-01-18, tertius <[EMAIL PROTECTED]> wrote: > >> Is there a builtin function that will enable me to display the hex >> notation of a given binary string? (example below) > > ' '.join('%02x' % ord(b) for b in s) Oops. Should be: ' '

Re: hex notation funtion

2005-01-18 Thread Grant Edwards
On 2005-01-18, tertius <[EMAIL PROTECTED]> wrote: > Is there a builtin function that will enable me to display the hex > notation of a given binary string? (example below) ' '.join('%02x' % ord(b) for b in s) -- Grant Edwards grante Yow! This is a NO-FRILLS

Re: hex notation funtion

2005-01-18 Thread [EMAIL PROTECTED]
This will do it: >>> int('1000', 2) 128 >>> hex(int('1000', 2)) '0x80' >>> -- http://mail.python.org/mailman/listinfo/python-list

Re: hex notation funtion

2005-01-18 Thread Philippe C. Martin
Would that do it? for i in my_byte_string: = atoi(binascii.hexlify(i),16) Regards, Philippe On Tue, 18 Jan 2005 20:43:44 +0200, tertius wrote: > Hi, > > Is there a builtin function that will enable me to display the hex > notation of a given binary string? (example below) > > man

Re: hex notation funtion

2005-01-18 Thread Irmen de Jong
tertius wrote: Hi, Is there a builtin function that will enable me to display the hex notation of a given binary string? (example below) Does this help: >>> "hello".encode("hex") '68656c6c6f' >>> "deadbeef".decode("hex") '\xde\xad\xbe\xef' ? --Irmen -- http://mail.python.org/mailman/listinfo/pytho

hex notation funtion

2005-01-18 Thread tertius
Hi, Is there a builtin function that will enable me to display the hex notation of a given binary string? (example below) many thanks Tertius () 02 11 00 00 46 5A 1A 82 02 11 00 39 36 39 33 39 FZ.96939 0016(0010) 36 39 33 00 0A 30 33 37 34 34 39 35 38 25 DD 01 693..0374495