I followed the great example at Python: Nicest way to pad zeroes to string (4) but now I need to turn that padded string to a padded 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 what I get is a list of integers sans the padding.
Appreciate any direction or suggestions.
Many thanks, Jack
Edit: After learning the revelation that integers don't get padded, I'm thinking a little differently, however it would probably be a good idea to explain more:
I'm working through a basic encryption exercise in a book. It has given me a list of pseduocode to work through - get cipher string 1-127 and a message, convert both to binary, strip off the 0b, and pad with zeroes. However it wants me to do the rest WITHOUT XOR! I've gotten that far one line at a time, but now comes this (where the problem begins):
- Perform manual XOR operation & append binary 7-bit result to encrypted string
- Convert each binary bit of message character and key to an integer
- Perform XOR operation on these two bits
- Convert literal True and False to binary bit & append to output
I've love to use the XOR operation but I'm afraid doing so I'm not going to learn what I need to.
-J