On Jun 13, 11:11 am, Allen <[EMAIL PROTECTED]> wrote:
> a = range(256)
> I want to output the formated string to be:
> 00 01 02 03 04 05 06 07   08 09 0a 0b 0c 0d 0e 0f
> 10 11 12 13 14 15 16 17   18 19 1a 1b 1c 1d 1e 1f
> ........................................................................
> f0 f1 f2 f3 f4 f5 6 f7   f8 f9 fa fb fc fd fe ff
>
> How to do it?

You can start with

   hex_list = [  ("0"+hex(i)[2:])[-2:] for i in a ]

This statement generates a list [ "00", "01", ... "ff"].

Now you only have to print this list.

Greetings, Uwe

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to