Re: How to run a function in SPE on Python 2.5

2011-06-22 Thread FunAt Work
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@prive-9dc0b2aec ~/PLScripts
$ python encrypt.py asdf
asdf
dafs

Run-2
UserXP@prive-9dc0b2aec ~/PLScripts
$ python encrypt.py 

babababa
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: writable iterators?

2011-06-22 Thread FunAt Work
Don't relate it anyhow to foreach of perl I would say, although the behaviour 
may be same in some aspect
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: what happens inside?

2011-06-22 Thread FunAt Work
Do the same thing with an interconversion of tuple and list and you will be off 
to the older way:
a=(1,2,3)
b=list(a)
b[0]=11
print a
print b

Output:
(1, 2, 3)
[11, 2, 3]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: connect windows share

2011-06-22 Thread FunAt Work
On my cygwin system I just do the following for my network drive 'q'

import commands
print commands.getoutput('ls /cygdrive/q')

Run it as - python fileList.py

Here is the output:

DataTables
Functions
Object_Repositories
Recovery_Scenarios
Scripts
-- 
http://mail.python.org/mailman/listinfo/python-list