How can I check the syntax of Python script without executing it?

前端 未结 8 1066
长发绾君心
长发绾君心 2020-11-29 14:17

I used to use perl -c programfile to check the syntax of a Perl program and then exit without executing it. Is there an equivalent way to do this for a Python s

8条回答
  •  悲&欢浪女
    2020-11-29 15:03

    for some reason ( I am a py newbie ... ) the -m call did not work ...

    so here is a bash wrapper func ...

    # ---------------------------------------------------------
    # check the python synax for all the *.py files under the
    # <

提交回复
热议问题