Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #51543
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Subject | Re: Bitwise Operations |
| Date | 2013-07-30 07:06 +0200 |
| Organization | None |
| References | <51F6DDBA.7030208@Gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5300.1375160802.3114.python-list@python.org> (permalink) |
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'
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Bitwise Operations Peter Otten <__peter__@web.de> - 2013-07-30 07:06 +0200
csiph-web