fork download
  1. class bitstr(str):
  2. def __or__(self, other):
  3. return bin(int(self, 2) | int(other, 2))[2:]
  4. # need to slice because 'bin' prefixes the result string with "0b".
  5.  
  6. a = '010110'
  7. b = bitstr('100000')
  8.  
  9. print(bitstr(a) | b)
  10.  
Success #stdin #stdout 0.02s 9944KB
stdin
Standard input is empty
stdout
110110