How python records command line execution commands

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!


look for the .bash _ history file in your user directory. There is the

you want.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35f35-2bfb9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35f35-2bfb9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?