Mar 012010
How to perform syntax check for Python program
Answer:
Assume you have a simple Python script hello.py, you want to perform syntax check. You can use the following method
# python -c 'import hello'
Traceback (most recent call last):
File "", line 1, in
File "hello.py", line 1
echo "Hello, World!"
If there is any syntax error, it will prompt out to the screen.