Which is the best python module for command execution
This question already has an answer here:
os.system always runs /bin/sh , which parses the command string. This can be a security risk if you have whitespace, $ etc. in the command arguments, or the user has a shell config file. To avoid all such risks, use subprocess with a list or tuple of strings as the command ( shell=False ) instead.
To emulate os.chdir in the command, use the cwd= argument in subprocess .
上一篇: 如何刷新Python打印输出?
下一篇: 哪个是执行命令的最佳python模块
