byte reverse AB CD to CD AB with python

后端 未结 4 488
迷失自我
迷失自我 2020-12-17 02:01

I have a .bin file, and I want to simply byte reverse the hex data. Say for instance @ 0x10 it reads AD DE DE C0, want it to read DE AD C0 DE.

I know there is a simp

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-17 02:29

    Python has a list operator to reverse the values of a list --> nameOfList[::-1]

    So, I might store the hex values as string and put them into a list then try something like:

    def reverseList(aList):
    rev = aList[::-1]
    outString = ""
    for el in rev:
        outString += el + " "
    return outString
    

提交回复
热议问题