Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #51543 > unrolled thread

Re: Bitwise Operations

Started byPeter Otten <__peter__@web.de>
First post2013-07-30 07:06 +0200
Last post2013-07-30 07:06 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Bitwise Operations Peter Otten <__peter__@web.de> - 2013-07-30 07:06 +0200

#51543 — Re: Bitwise Operations

FromPeter Otten <__peter__@web.de>
Date2013-07-30 07:06 +0200
SubjectRe: Bitwise Operations
Message-ID<mailman.5300.1375160802.3114.python-list@python.org>
Devyn Collier Johnson wrote:

> On Python3, how can I perform bitwise operations? For instance, I want
> something that will 'and', 'or', and 'xor' a binary integer.

>>> 0b1010 | 0b1100
14
>>> bin(_)
'0b1110'
>>> 0b1010 & 0b1100
8
>>> bin(_)
'0b1000'
>>> 0b1010 ^ 0b1100
6
>>> bin(_)
'0b110'

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web