increment bits

Bill Mill bill.mill at gmail.com
Thu May 12 15:36:09 EDT 2005


On 12 May 2005 12:19:15 -0700, ashtonn at gmail.com <doodle4 at gmail.com> wrote:
> Hello,
> 
> How do i manipulate arrays to increment 8 bits at a time.
> 
> I need to generate a pattern like
> 01,02,03,.....0xFF

>>> [hex(n) for n in range(256)]
['0x0', '0x1', '0x2', '0x3', '0x4', '0x5', '0x6', '0x7', '0x8', '0x9', '0xa', '0
xb', '0xc', '0xd', '0xe', '0xf', '0x10', '0x11', '0x12', '0x13', '0x14', '0x15',
 '0x16', '0x17', '0x18', '0x19', '0x1a', '0x1b', '0x1c', '0x1d', '0x1e', '0x1f',
<snipped>
 '0xe8', '0xe9', '0xea', '0xeb', '0xec', '0xed', '0xee', '0xef', '0xf0', '0xf1',
 '0xf2', '0xf3', '0xf4', '0xf5', '0xf6', '0xf7', '0xf8', '0xf9', '0xfa', '0xfb',
 '0xfc', '0xfd', '0xfe', '0xff']

Peace
Bill Mill
bill.mill at gmail.com



More information about the Python-list mailing list