[Tutor] binary data as string?

"Jörg Wölke" lumbricus at gmx.net
Fri Apr 16 09:03:40 EDT 2004


Hello!

[ snip ]

> mask = 1
> data = 42
> for n in range(8):
>    print (data & mask) and 1 or 0,
>    mask = mask << 1

s/<</>>/
 
> Will print out the bit pattern of 42...
> 
> HTH,
> 
> Alan G
> Author of the Learn to Program web tutor
> http://www.freenetpages.co.uk/hp/alan.gauld

Greets, J"o!

-- 
Sie duerfen diesen Satz zitieren.

NEU : GMX Internet.FreeDSL
Ab sofort DSL-Tarif ohne Grundgebühr: http://www.gmx.net/info




More information about the Tutor mailing list