now the requirement is to write a log file. I want to record the running command of the python script at the beginning of the log file. For example, my command line call command is python3 test.py-a hellow-b wolrd
. I want to record the string "log-a hellow-b wolrd" in the log. Here is my implementation, but I can"t record whether the first one is using python3 or python.
-sharp!/usr/bin/env python3
-sharp coding: utf-8
import sys
args = " ".join(sys.argv)
print(args)
call: python test.py-a hellow-b wolrd
output: test.py-a hellow-b wolrd
how to record the call command completely, thank you!