Skip to content

Instantly share code, notes, and snippets.

@malustewart
Created May 8, 2019 17:21
Show Gist options
  • Save malustewart/fc6b8a1cabb3589734d9c686fdd3c44a to your computer and use it in GitHub Desktop.
Save malustewart/fc6b8a1cabb3589734d9c686fdd3c44a to your computer and use it in GitHub Desktop.
change string endianness python
#sacado de alguna respuesta de stack overflow que ahora no encuentro
def change_endianness(s):
return "".join(reversed([s[i:i+2] for i in range(0, len(s), 2)]))
#Para correrlo desde consola de pycharm:
#import sys
#sys.path.append("path/hasta/carpeta/que/contiene/este/archivo)
#import endian
#endian.change_endianness("1234")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment