It happens that there is nothing to do recently, optimize a deployment script of the project, and revisit python
os.path.dirname( file ) # The directory where the current file is located is equivalent to that of the shell cd $(dirname $0;);pwd
, and the output is only the directory
os.path.realpath( file ) will carry the script name