What is the Python equivalent of `set -x` in shell?

后端 未结 3 2072
有刺的猬
有刺的猬 2020-12-04 19:16

Please suggest Python command which is equivalent of set -x in shell scripts.

Is there a way to print/log each source file line executed by Python?

3条回答
  •  春和景丽
    2020-12-04 20:14

    You can use the trace module:

    python -m trace -t your_script.py
    

    The command line above will display every line of code as it is executed.

提交回复
热议问题