Re: Concise way to format list/array to custom(hex) string

2008-08-02 Thread josh logan
On Aug 2, 9:29 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-08-02, Zoltán Nagy <[EMAIL PROTECTED]> wrote: > > > > > > > Kurien Mathew írta: > >> Hello, > > >> What will be a concise & efficient way to convert a list/array.array of > >> n elements into a hex string? For e.g. given the byte

Re: Concise way to format list/array to custom(hex) string

2008-08-02 Thread Grant Edwards
On 2008-08-02, Zoltán Nagy <[EMAIL PROTECTED]> wrote: > Kurien Mathew írta: >> Hello, >> >> What will be a concise & efficient way to convert a list/array.array of >> n elements into a hex string? For e.g. given the bytes >> [116, 111, 110, 103, 107, 97] >> I would like the formatted string >> 0x7

Re: Concise way to format list/array to custom(hex) string

2008-08-02 Thread Zoltán Nagy
Kurien Mathew írta: > Hello, > > What will be a concise & efficient way to convert a list/array.array of > n elements into a hex string? For e.g. given the bytes > [116, 111, 110, 103, 107, 97] > I would like the formatted string > 0x74 0x6f 0x6e 0x67 0x6b 0x61 > > Is there an approach better tha

Re: Concise way to format list/array to custom(hex) string

2008-08-02 Thread John Machin
On Aug 2, 9:53 pm, Kurien Mathew <[EMAIL PROTECTED]> wrote: > Hello, > > What will be a concise & efficient way to convert a list/array.array of > n elements into a hex string? For e.g. given the bytes > [116, 111, 110, 103, 107, 97] > I would like the formatted string > 0x74 0x6f 0x6e 0x67 0x6b 0x

Concise way to format list/array to custom(hex) string

2008-08-02 Thread Kurien Mathew
Hello, What will be a concise & efficient way to convert a list/array.array of n elements into a hex string? For e.g. given the bytes [116, 111, 110, 103, 107, 97] I would like the formatted string 0x74 0x6f 0x6e 0x67 0x6b 0x61 Is there an approach better than below: hex = '' for b in bytes: