[Tutor] question about looping.

2006-10-06 Thread Doug Potter
Hi, I at trying to create a bunch of text files in a single directory on a Linux system, something like this. import os routers = ['adnc-6321', 'adnp-2341', 'adnw-2632'] for i in routers: os.system('/bin/touch' %s) % i of course this dosn't work. Is there a simple way to get this done?

Re: [Tutor] Luke, thanks a lot , here is the perfect code (as per ur suggestion)

2006-10-06 Thread Asrarahmed Kadri
Thanks for the detailed explanation. I read it and understood a bit. Rest in the leisure time.   Enjoy the recipes.. Regards, Asrar  On 10/5/06, Kent Johnson <[EMAIL PROTECTED]> wrote: Asrarahmed Kadri wrote:> What is this??? I cannot understand a single character.. Explain this in > length

Re: [Tutor] question about looping.

2006-10-06 Thread Kent Johnson
Doug Potter wrote: > Hi, > > I at trying to create a bunch of text files in a single directory on a > Linux system, > something like this. > > import os > > routers = ['adnc-6321', 'adnp-2341', 'adnw-2632'] > > for i in routers: > os.system('/bin/touch' %s) % i I think you're close, just

[Tutor] Trying tio emulate "diff" command of UNIX - please help

2006-10-06 Thread Asrarahmed Kadri
# This program emulates the diff command of UNIX import sysfrom stringCompare import stringcmp   # this is a module which has stringcmp function that compares two strings fname1 = raw_input("Enter a file name to be read:\t") fname2 = raw_input("Enter a file name to be read:\t")   fd1 = open(fname1

Re: [Tutor] Trying tio emulate "diff" command of UNIX - please help

2006-10-06 Thread Senthil_OR
Hi,   Your program does not emulate the diff command of Unix. Please do a diff in unix and experience yourselves.   Where is cmp_res = stringcmp(string1[i],string2[i]) stringcmp() function written?   Moreover, if you Python Documentation install (or python.org accessible) search for diffli

Re: [Tutor] question about looping.

2006-10-06 Thread Carlos Hanson
Doug Potter wrote: > Hi, > > I at trying to create a bunch of text files in a single directory on a > Linux system, > something like this. > > import os > > routers = ['adnc-6321', 'adnp-2341', 'adnw-2632'] > > for i in routers: > os.system('/bin/touch' %s) % i > > of course this dosn't w

Re: [Tutor] Trying tio emulate "diff" command of UNIX - please help

2006-10-06 Thread Alan Gauld
Some general thoughts: > import sys > from stringCompare import stringcmp # this is a module which has > stringcmp > > fname1 = raw_input("Enter a file name to be read:\t") > fname2 = raw_input("Enter a file name to be read:\t") > > fd1 = open(fname1,"r") > fd2 = open(fname2,"r") > > > done = F

Re: [Tutor] Trying tio emulate "diff" command of UNIX - please help

2006-10-06 Thread Asrarahmed Kadri
Thanks Alan, but can you please explain me what this line does: diff = [t1==t2 for t1,t2 in zip(line1,line2)].index(False)    On 10/6/06, Alan Gauld <[EMAIL PROTECTED]> wrote: Some general thoughts:> import sys> from stringCompare import stringcmp   # this is a module which has > stringcmp>> fname1

[Tutor] Share variables between py scripts

2006-10-06 Thread Bennett, Joe
Can anyone direct me to some documentation on how to take variables from one py script, execute and pass them to another script? Then I need to get data back from the executed script? I've been searching Google and I see information, but I am in need of some examples...     Thanks! -Joehttp://www.d

[Tutor] Help: how to detect which key is pressed

2006-10-06 Thread Asrarahmed Kadri
    I am writing a simple program and in that I want to add some sort of interactiveness. I have designed a menu which gives the user an option to select one out of the following four keys: d, l, n or e. Can any one tell me how to determine which key has been pressed by the user.   Thanks. Regards,

Re: [Tutor] Share variables between py scripts

2006-10-06 Thread Eric Walstad
Bennett, Joe wrote: > Can anyone direct me to some documentation on how to take variables from > one py script, execute and pass them to another script? Then I need to > get data back from the executed script? I've been searching Google and I > see information, but I am in need of some examples.

[Tutor] when I create an instance of a class that inherits from Python dictionary, my data disappears

2006-10-06 Thread tpc247
hi all, I would like to create a class that specializes Python dictionary.  I would like an instance of this class to store objects representing html form data, and I would like to have an instance of this Data_Set class be able to use the Python dictionary method pop to remove objects as I see fit

Re: [Tutor] Trying tio emulate "diff" command of UNIX - please help

2006-10-06 Thread ALAN GAULD
> Thanks Alan, but can you please explain me what this line > does: > diff = [t1==t2 for t1,t2 in zip(line1,line2)].index(False) > I'll unfold it somewhat: mix = zip(a,b) produces a list of tuples: [(a1,b1)(a2,b2),(a3,b3)] t1 == t2 produces a boolean result either True or False

Re: [Tutor] Help: how to detect which key is pressed

2006-10-06 Thread Luke Paireepinart
Asrarahmed Kadri wrote: > > > I am writing a simple program and in that I want to add some sort of > interactiveness. > I have designed a menu which gives the user an option to select one > out of the following four keys: d, l, n or e. > Can any one tell me how to determine which key has been

Re: [Tutor] when I create an instance of a class that inherits from Python dictionary, my data disappears

2006-10-06 Thread Bob Gailer
[EMAIL PROTECTED] wrote: > hi all, I would like to create a class that specializes Python > dictionary. I would like an instance of this class to store objects > representing html form data, and I would like to have an instance of > this Data_Set class be able to use the Python dictionary metho