Bryan Leber wrote: > > Hello, I am trying to create a script that reads from the command line > and puts the sysargv into a list. I have this part done. I have added > code for testing and one of those testing procedures is to print the > list out in a text file. Not all field are required and may not have > information in them. A sample text file looks like this: > > > > PATCH_NUMBER: 9999 > > BUG_NUMBER: 4534 > > FEATURE_AFFECTED: Admin login > > OVERVEIW: The icon of the submit has changed > > > > Now what I need to accomplish is to search through this list and if > FEATURE_AFFECTED or OVERVIEW do not have values(i.e. Admin login or > The icon of the submit changed) then I need to print a message and > then exit. Right now I have something like this > > > > Size = len(argsList) > > If size = 4 > > For i in argsList > > If i[2] == None: > > Print ‘please enter criteria’ > > Sys.exit() > > Elif i[3] == None: > > Print ‘please enter criteria’ > > Sys.exit() > > Else: > > Sys.exit() > > > > Any help would be appreciated. Thanks > > > > > > **/Bryan Leber/** > > Developer > > Fischer International Corporation > > www.fischerinternational.com <http://www.fischerinternational.com> > > [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]> > > Cell:(239)963-5267 > > > > Secure Your Risk. Increase Your Bottom Line. ™ > > > > ------------------------------------------------------------------------ > > This mail message may contain confidential and privileged information > from Fischer International which is protected. Any unauthorized > review, use, disclosure or distribution by any means is prohibited. > If you are not the intended recipient, please contact the sender by > reply email and destroy all copies of the original message > > ------------------------------------------------------------------------
I recommend that you check out the optparse.module from OptionParser It does what you are looking for in a concise method. See http://docs.python.org/lib/module-optparse.html _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor