Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # gotcha|pitfall: my original idea, but this generates a list of 1-tuples:
- # x = [struct.unpack("b",a) for a in charlist]
- fmt = "%ib"%len(charlist) # eg. "5b", if charlist's length is 5
- x = struct.unpack(fmt,charlist) # tuple of ints
- [i - 255 if i > 127 else i for i in [ord(l) for l in "azertyuiopqsdféhjklm3{"]]
- def to_ints(input):
- return [o if o <= 128 else 255 - o for o in [ord(char) in input]]
- def to_str(input):
- return "".join([chr(i%256) for i in input])
- out = to_ints("This is a test")
- print to_str(out)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement