unsigned long to unsigned char

Diez B. Roggisch deets at web.de
Wed Jun 1 21:00:07 CEST 2005


ashtonn at gmail.com wrote:
> Hello,
> 
> Is it possible to convert unsigned long( 4 bytes) to unsigned char(1
> byte), so that i could define a common array for both.
> 
> import array
> temp = array('B', '\0' * 512)
> 
> for i in range( 2):
>     temp[0] = 0xFF
>     temp[1] = 0xFFFFFFFF

use module struct.

Diez



More information about the Python-list mailing list