在python中调用shell命令获得返回值

获得用户名
users = commands.getoutput('echo $USER').strip()

原文地址:https://www.cnblogs.com/artesian0526/p/13476045.html