I am calling a python script from PHP.
The python program has to return some value according to the arguments passed to it.
Here is a sample python program,
That is correct use of exit(). See also: http://docs.python.org/library/sys.html