Python3 大小端翻转

import binascii
 
def big_small_end_convert(data):
    return binascii.hexlify(binascii.unhexlify(data)[::-1])
 
if __name__ =='__main__':
    di = b'12345678'
    do = big_small_end_convert(di)
    print(di)
    print(do)

运行结果:

b'12345678'
b'78563412' 

希望对大家有所帮助

posted @ 2020-12-22 10:26  knva  阅读(50)  评论(0编辑  收藏