How to run a function in SPE on Python 2.5
MRAB
python at mrabarnett.plus.com
Wed Jun 22 22:42:07 EDT 2011
On 23/06/2011 03:19, bill lawhorn wrote:
> I have a program: decrypt2.py which contains this function:
>
>
> def scramble2Decrypt(cipherText):
> halfLength = len(cipherText) // 2
> oddChars = cipherText[:halfLength]
> evenChars = cipherText[halfLength:]
> plainText = ""
>
> for i in range(halfLength):
> plainText = plainText + evenChars[i]
> plainText = plainText + oddChars[i]
>
[snip]
FYI, this can be shortened to:
plainText = cipherText[0 : : 2] + cipherText[1 : : 2]
More information about the Python-list
mailing list