#!/usr/bin/python3 # -*- coding: utf-8 -*- import operator print(1 ^ 0) print(0 ^ 1) print(1 ^ 1) print(0 ^ 0) # or where the operator lives print(operator.xor(1, 0)) print(operator.xor(0, 1)) print(operator.xor(1, 1)) print(operator.xor(0, 0)) # Example on binary strings: print(31 ^ 30) print(bin(0b1111 ^ 0b1110))