Question About Command line arguments

2011-06-10 Thread Mark Phillips
I have a script that processes command line arguments def main(argv=None): syslog.syslog(Sparkler stared processing) if argv is None: argv = sys.argv if len(argv) != 2: syslog.syslog(usage()) else: r = parseMsg(sys.argv[1]) syslog.syslog(r)

Re: Question About Command line arguments

2011-06-10 Thread Mark Phillips
On Fri, Jun 10, 2011 at 10:41 AM, MRAB pyt...@mrabarnett.plus.com wrote: On 10/06/2011 18:21, Mark Phillips wrote: I have a script that processes command line arguments def main(argv=None): syslog.syslog(Sparkler stared processing) if argv is None: argv = sys.argv

Re: Question About Command line arguments

2011-06-10 Thread Mark Phillips
On Fri, Jun 10, 2011 at 11:03 AM, Kurt Smith kwmsm...@gmail.com wrote: On Fri, Jun 10, 2011 at 12:58 PM, Mark Phillips m...@phillipsmarketing.biz wrote: How do I write my script so it picks up argument from the output of commands that pipe input into my script? def main(): import sys

Re: How to convert a string into a list

2010-10-05 Thread Mark Phillips
Thanks to everyone for their suggestions. I learned a lot from them! Mark On Mon, Oct 4, 2010 at 11:54 PM, Chris Rebert c...@rebertia.com wrote: On Mon, Oct 4, 2010 at 10:33 PM, Arnaud Delobelle arno...@gmail.com wrote: MRAB pyt...@mrabarnett.plus.com writes: On 05/10/2010 02:10, Mark

How to convert a string into a list

2010-10-04 Thread Mark Phillips
I have the following string - ['1', '2'] that I need to convert into a list of integers - [1,2]. The string can contain from 1 to many integers. Eg ['1', '7', '4',..,'n'] (values are not sequential) What would be the best way to do this? I don't want to use eval, as the string is coming from