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/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) many

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 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 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 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 be:

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