- 论坛徽章:
- 0
|
各位好:
我想把python的进程名修改掉,比如
python test.py 1 2 3
改为 pytest
在网上搜到一些信息,能把进程名改掉- import os, sys
- proc='pytest'
- if not os.environ.has_key('NEWPROCNAME'):
- os.execlpe(sys.executable, procname, __file__, {'NEWPROCNAME':
- procname})
复制代码 但参数依然保留了,变成了pytest 1 2 3
请问如何能把它的参数也去除显示
从os的文档看,类似的方法都是自动带参数了- os.execl(path, arg0, arg1, ...)
- os.execle(path, arg0, arg1, ..., env)
- os.execlp(file, arg0, arg1, ...)
- os.execlpe(file, arg0, arg1, ..., env)
- os.execv(path, args)
- os.execve(path, args, env)
- os.execvp(file, args)
- os.execvpe(file, args, env)
复制代码 |
|