How to print python commands automatically?

rusi rustompmody at gmail.com
Thu Nov 8 21:50:08 EST 2012


On Nov 9, 4:12 am, Peng Yu <pengyu... at gmail.com> wrote:
> Hi,
>
> In bash, set -v will print the command executed. For example, the
> following screen output shows that the "echo" command is printed
> automatically. Is there a similar thing in python?
>
> ~/linux/test/bash/man/builtin/set/-v$ cat main.sh
> #!/usr/bin/env bash
>
> set -v
> echo "Hello World!"
> ~/linux/test/bash/man/builtin/set/-v$ ./main.sh
> echo "Hello World!"
> Hello World!
>
> Regards,
> Peng

Is this what you want?
http://docs.python.org/2/library/trace.html



More information about the Python-list mailing list