-3

when a user enters some commands to enable or disable service/process,i need to capture that command line arguments entered by the user and i have to send those values to some schedulers in python,can anybody help me on this how to proceed?

user2572165
  • 51
  • 1
  • 4
  • 1
    Welcome to Stack Overflow. Please read [Stack Overflow: How to ask](http://stackoverflow.com/questions/how-to-ask) and [John Skeet's Question Checklist](http://msmvps.com/blogs/jon_skeet/archive/2012/11/24/stack-overflow-question-checklist.aspx) to find out how to ask a good question that will generate good useful, answers. – Our Man in Bananas Jul 02 '14 at 09:42

1 Answers1

0

You can process simple command line arguments like this:

import sys
myargs = sys.argv[1:]
print(myargs)

I don't know how your scheduler works, but you can do whatever you want with the items in the list myargs.

Demo

>> python program.py 1 2 3
['1', '2', '3']

For more complicated command line tools, consider using argparse.

timgeb
  • 76,762
  • 20
  • 123
  • 145