mardi 14 juin 2016

Python execute if/else statement based on sys.argv passed on Command Line

I am new to Python and the syntax is really throwing me off. I need to execute a script in which I'd like to execute a function based on the arguments passed on Command Line. Following is the pseudo code:

import sys

...
Code
Authentication
Role Validation 
...

Arg[1]
Arg[2]
Arg[3]

if(Arg[3] !exist)
  execute Func1 with Arg[1] & Arg[2]
else if 
  execute Func 2 with Arg[1], [2] & [3]

Can someone guide me how to structure this in Python's world or if there is any other way to do it?

Aucun commentaire:

Enregistrer un commentaire