Re: Passing parameters at the command line (New Python User)

2007-09-24 Thread Steven Bethard
[EMAIL PROTECTED] wrote: > Hi there. I just wondered whether anyone could recommend the correct > way I should be passing command line parameters into my program. I am > currently using the following code: > > def main(argv = None): > > > file1= "directory1" > file2 = "directory2" > >

Re: Passing parameters at the command line (New Python User)

2007-09-24 Thread Marc 'BlackJack' Rintsch
On Mon, 24 Sep 2007 01:04:58 -0700, cjt22 wrote: > for i in range(len(args)): > if args[i] == "-no": > Initialise.init(0) > Process.processCon(file2,1) > Output.print() > > if args[i] == "-not": >Initialise.init(1) >

Re: Passing parameters at the command line (New Python User)

2007-09-24 Thread Ben Finney
[EMAIL PROTECTED] writes: > I have never used Python to pass in arguments at the command line so > any help would be much appreciated. Your 'main()' approach is good. I'd rather have the function require an 'argv' parameter, and have the default set only in the 'if __name__ == "__main__":' block,

Re: Passing parameters at the command line (New Python User)

2007-09-24 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Hi there. I just wondered whether anyone could recommend the correct > way I should be passing command line parameters into my program. I am > currently using the following code: Use the module optparse. Diez -- http://mail.python.org/mailman/listinfo/python-list