使用自动填充补零有两种方法一种是formatIn [27]: '{0:09b}'.format(1)Out[27]: '000000001'另一种是zfillIn [29]: bin(1)[2:].zfill(9)Out[29]: '000000001'