little= int.from_bytes(bytes('ab', encoding='utf8'), 'little') big = int.from_bytes(bytes('ab', encoding='utf8'), 'big') print('little: {:0>16b}'.format(little)) print('big: {:0>16b}'.format(big)) print('a: {:0>8b}'.format(ord('a'))) print('b: {:0>8b}'.format(ord('b'))) # little: 01100010 01100001 小端就是小值放在低地址位 # big: 01100001 01100010 # a: 01100001 # b: 01100010