Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #51544
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Subject | Re: Bitwise Operations |
| Date | 2013-07-30 01:46 -0400 |
| References | <mailman.5275.1375134621.3114.python-list@python.org> <kt6o8t$l55$1@reader1.panix.com> <51F6FBE8.8000106@Gmail.com> <CAPTjJmoqsYp6Q3YdkOBrRfXU4HcmiKS9ZSrk-KhYnx8nwgoP=w@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5301.1375163230.3114.python-list@python.org> (permalink) |
On 7/29/2013 7:44 PM, Chris Angelico wrote: > But there's an easier way: > >>>> x = 0b101 & 0b010 >>>> x > 0 > > I think that might do what you want. Also check out the bin() > function, which will turn an integer into a string of digits. >>> bin(0b101 | 0b010) '0b111' Now you are set to go. Have fun. -- Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Bitwise Operations Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-29 17:25 -0400
Re: Bitwise Operations Grant Edwards <invalid@invalid.invalid> - 2013-07-29 21:53 +0000
Re: Bitwise Operations Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-29 19:34 -0400
Re: Bitwise Operations Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2013-07-30 08:20 +0200
Re: Bitwise Operations Ethan Furman <ethan@stoneleaf.us> - 2013-07-29 16:41 -0700
Re: Bitwise Operations Chris Angelico <rosuav@gmail.com> - 2013-07-30 00:44 +0100
Re: Bitwise Operations Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-29 19:48 -0400
Re: Bitwise Operations Chris Angelico <rosuav@gmail.com> - 2013-07-30 01:07 +0100
Re: Bitwise Operations MRAB <python@mrabarnett.plus.com> - 2013-07-30 02:55 +0100
Re: Bitwise Operations Terry Reedy <tjreedy@udel.edu> - 2013-07-30 01:46 -0400
csiph-web