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.
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 pseudocode to work through;
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):
I'd love to use the XOR operation but am afraid that doing so would mean I'm not going to learn what I need to.
Applying idea of padding to integers is meaningless. If you want to print/represent them you need strings, integers just don't have padding.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With