Python 2.7相当于bash -x

时间:2016-07-19 09:26:44

标签: python python-2.7

Python 2.7中是否有等效的bash -x

如果您不熟悉bash,

$ ./hello.sh
Hello world
Hello world
Hello world
Hello world
Hello world
$ bash -x ./hello.sh
+ var=5
++ seq 1 5
+ for i in '`seq 1 $var`'
+ echo 'Hello world'
Hello world
+ for i in '`seq 1 $var`'
+ echo 'Hello world'
Hello world
+ for i in '`seq 1 $var`'
+ echo 'Hello world'
Hello world
+ for i in '`seq 1 $var`'
+ echo 'Hello world'
Hello world
+ for i in '`seq 1 $var`'
+ echo 'Hello world'
Hello world

这有助于快速调试流程等,即使对于运行时间很长的脚本也是如此。

0 个答案:

没有答案