How to run a function in SPE on Python 2.5

B

bill lawhorn

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
plainText = plainText + oddChars

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

return plainText

When I load this program in SPE and click on debug with winpdb i'm not
sure what to do next. In Idle I would just
type in scramble2Decrypt("aaaabbbb"), hit enter an get a result.

I have tried to call this function from the Command box in winpdb and
also at the >> in SPE with no luck.

I want to be able to step through the program one line at a time.

Any help would be appreciated for this nube.
 
M

MRAB

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
plainText = plainText + oddChars

[snip]
FYI, this can be shortened to:

plainText = cipherText[0 : : 2] + cipherText[1 : : 2]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,265
Latest member
TodLarocca

Latest Threads

Top