I am surprised there is no mention of a nice way to accomplish this using formatting strings that are supported in Python 3.6 and higher. TLDR:
>>> number = 1>>> f'0b{number:08b}''0b00000001'
Longer story
This is functionality of formatting strings available from Python 3.6:
>>> x, y, z = 1, 2, 3>>> f'{x} {y} {2*z}''1 2 6'
You can request binary as well:
>>> f'{z:b}''11'
Specify the width:
>>> f'{z:8b}'' 11'
Request zero padding:
f'{z:08b}''00000011'
And add common prefix to signify binary number:
>>> f'0b{z:08b}''0b00000011'
You can also let Python add the prefix for you but I do not like it so much as the version above because you have to take the prefix into width consideration:
>>> f'{z:#010b}''0b00000011'
More info is available in official documentation on Formatted string literals and Format Specification Mini-Language.