News wrote:
> Hi everyone,
> 
> My goal is to pull command switches/options from a file and then assign
> the values to select variables which would eventually be included in a
> class object.
> 
> The data file looks something like this but the switches could be in any
> order and not all may be used.
> 
> -m quemanager -s server -p port -k key -o object -c 20 -t [EMAIL PROTECTED]
> 
> Also, please keep in mind that the source code will have more than one
> line in it and each has to be treaded separately.

I think you could just use getopt or optparse, passing in each line 
after doing a simple .split() on it.  The resulting handling of the 
arguments would be much simpler and cleaner than what you have.

That won't work perfectly well if you can have quoted arguments with 
spaces in them, however, but the example above does not.

-Peter

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

Reply via email to