How to run a function in SPE on Python 2.5

FunAt Work karamheenkuriyaar at gmail.com
Wed Jun 22 23:41:32 EDT 2011


Not tried SPE. But in PyScripter, as simple as that.

import sys
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]

    if len(oddChars) < len(evenChars):
        plainText = plainText + evenChars[-1]

    return plainText



if __name__ == '__main__':
   print sys.argv[1]
   print scramble2Decrypt(sys.argv[1])


Run as inside the scripter in debug mode either or run from command line as:

Run-1
UserXP at prive-9dc0b2aec ~/PLScripts
$ python encrypt.py asdf
asdf
dafs

Run-2
UserXP at prive-9dc0b2aec ~/PLScripts
$ python encrypt.py aaaabbbb
aaaabbbb
babababa



More information about the Python-list mailing list