getopt issues

David Boddie davidb at mcs.st-and.ac.uk
Thu Aug 28 19:10:28 EDT 2003


David Bear <iddwb at asu.edu> wrote in message news:<Pine.LNX.4.44.0308281021290.18558-100000 at moroni.pp.asu.edu>...

> good points.  yet, my purpose is to write a filter.  the problem being 
> that with different lpr implementations you don't know exactly what 
> parameters will be passed since lpr is not really standardize (at least 
> thats my understanding). I'm just interested in two parameters out of 
> possibly many.  

Can't you specify all the possible parameters and collect only those you
want, or are you dealing with conflicting specifications of certain options?

> Still, I think getopt is rather weak.  It would be better if I could build 
> a dictionary of options that I wanted, then when parsing the args, just 
> fill in my dictionary values from args that I want.

As an aside, since it doesn't deal with cases where the option is
concatenated with the following parameter, you might find cmdsyntax
interesting since it aims to populate dictionaries with appropriately
named entries for the command line input:

http://www.boddie.org.uk/david/Projects/Python/CMDSyntax/index.html

It will also try and parse the arguments and return a list of failed
matches if requested.

However, it may well be overkill for your purposes.

David




More information about the Python-list mailing list