I've two functions, and I want to choose function message()
or function number()
on a UNIX
terminal.
This example I define the function will be used inside if __name__ == "__main__":
:
import sys
def message(m=sys.argv[2]):
print(" {} ".format(m))
if __name__ == "__main__":
message()
At terminal Inputting:
$python test.py python!
Outupts:
python!
Then when I've two functions and call just one of them:
import sys
def message(m=sys.argv[1]):
print(" {} ".format(m))
def number(n=sys.argv[1]):
print(" {} ".format(n+2))
if __name__ == "__main__":
#code that should be here