Hi All,
I have a below piece of code, Is it possible to use the green color code single time for different variables ?
Right now this code run as:
#python3.6 testing.py -i desert -w 380 -c 400
OK - Active Users: 368
OR
#python3.6 testing.py -i ocean -w 380 -c 400
OK - Active Users: 65
*Note Please assume that i am parsing command line arguments. And variable tuple stored different numbers
rlinux57
I have a below piece of code, Is it possible to use the green color code single time for different variables ?
Right now this code run as:
#python3.6 testing.py -i desert -w 380 -c 400
OK - Active Users: 368
OR
#python3.6 testing.py -i ocean -w 380 -c 400
OK - Active Users: 65
*Note Please assume that i am parsing command line arguments. And variable tuple stored different numbers
# validate args if len(sys.argv)==1: print("# Usage:\t -w <warn> -c <crit>") sys.exit("No argument pass") elif input_value == "desert": if tuple[0] > c_value: print("CRITICAL - Active: ",tuple[0]) sys.exit(2) elif tuple[0] > w_value: print("WARNING - Active:",tuple[0]) sys.exit(1) else: print("OK - Active Users:",tuple[0]) sys.exit(0) elif input_value == "ocean": ###Again use the above chunk of code in green which check critical, warning and ok condition just change to tuple[1] > c_value and so on###Regards,
rlinux57