[Tutor] bitwise ops in Idle

Alan Gauld alan.gauld at blueyonder.co.uk
Fri Nov 21 02:00:14 EST 2003

> I am trying to get the value of a reiterative XOR operation and
> I'd use Idle to figure it out. I thought the module which
allows for
> bitwise ops was the operator module, so I first did:
> import operator

You don't need that. Just use the xor operator(~)

>>> print ~0x01
>>> print "%X" % ~0x01

Alan G.

More information about the Tutor mailing list