How do I write the option to check the Python code only for syntax?

Asked 2 years ago, Updated 2 years ago, 20 views

In Perl, it was possible to use -c to check only the syntax.

Python also wants to check the syntax, not "execute", but I wonder how to do it here.

python syntax-checking

2022-09-22 22:15

1 Answers

The Python code cannot determine the syntax until it is compiled. I'll give you the option to compile it like this is it

$ python -m py_compile script.py


2022-09-22 22:15

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.