Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Bitwise Operations

Reply
Thread Tools

Re: Bitwise Operations

 
 
Peter Otten
Guest
Posts: n/a
 
      07-30-2013
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'


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bitwise operations on a byte array Chris Java 6 01-05-2007 05:51 PM
BitWise Operations =?Utf-8?B?Sm9u?= ASP .Net 3 01-24-2006 09:19 AM
Bitwise operations in Python? Carl Python 3 08-19-2005 12:02 AM
newbie seeks insight on bitwise operations.. Alan Holloway C Programming 11 07-30-2004 09:51 PM
Re: seeking bitwise operations solution E. Robert Tisdale C Programming 4 08-18-2003 02:15 AM



Advertisments