I followed a great example in Python: The best way to put zeros in a string is (4),
but now I need to turn this filled string into a filled integer.
I tried:
list_padded=['0001101', '1100101', '0011011', '0011011', '1101111',
'0000001', '1110111', 1101111', '0111001', '0011011',
'0011001'] # My padded sting list.
int_list=[int(x) for x in list_padded] # convert the string to an INT
But I get a list of integers without padding.
Appreciate any direction or suggestions.
Thanks a lot Jack
Edit: Having studied the revelation that integers are not being filled, I think a little differently, however it would be nice to explain more:
I am working on a basic encryption exercise in a book. He gave me a pseduocode list to work with - get the encryption line 1-127 and message, convert both to binary, separate 0b and pad with zeros. However, he wants me to leave WITHOUT CHORUS! I got this line at a time, but now it happens (where the problem starts):
- Perform a manual XOR operation and add a binary 7-bit result to the encrypted string
- Convert each binary bit of the message character and key to an integer
- Perform an XOR operation for these two bits
- Convert literal True and False to binary bit and append to output
I love to use the XOR operation, but I'm afraid I'm not going to learn what I need.
-J
source
share