Created
May 8, 2019 17:21
-
-
Save malustewart/fc6b8a1cabb3589734d9c686fdd3c44a to your computer and use it in GitHub Desktop.
change string endianness python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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