Python os.getgrouplist() Method
Example
Print the list of all group ids for a specified user:
#Import os Library
import os
#print the list of all group ids
for the specified user
print(os.getgrouplist("admin", 100))
Try it Yourself »
Definition and Usage
The os.getgrouplist()
method returns a list
of all group
ids for a specified user.
Note: This method is available only for Unix.
Syntax
os.getgrouplist(user, group)
Parameter Values
Parameter | Description |
---|---|
user | Required. Specifies the name of a system user |
group | Required. Specifies a group id |
Technical Details
Return Value: | A list, representing all group ids the specified user belongs to |
---|---|
Python Version: | 3.3 |