import os print(os.getuid()) print(os.getgid())<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);"> </span>将上面的程序保存为py_id.py文件,分别用$python py_id.py和$sudo python py_id.py看一下运行结果
import os print(os.getresuid())输出:
原文地址:http://blog.csdn.net/xufeng0991/article/details/40180603