get the exit code for python program

python

Solution

From a Windows command line you can use:

echo %ERRORLEVEL%

For example:

C:\work>python helloworld.py
Hello World!

C:\work>echo %ERRORLEVEL%
0

Problem

I'm running a python program on WindowsXP. How can I obtain the exit code after my program ends?

Original source