bin(n).replace("0b", "") code example Example: python bin function without 0b >>> bin(30)[2:].zfill(8) '00011110' >>>