May-09-2021, 10:10 PM
How do i put my users in a dictionary, then access the key value pairs uid, name and shell?
How to put users in a dictionary?
|
May-09-2021, 10:10 PM
How do i put my users in a dictionary, then access the key value pairs uid, name and shell?
May-09-2021, 10:19 PM
from dataclasses import dataclass @dataclass() class User: uid: str name: str shell: str user_dict = {} user1 = User('1', '2', '3') user_dict[user1.uid] = user1 print(user_dict) print(user_dict['1'].name) print(user_dict['1'].shell)
May-09-2021, 10:22 PM
(This post was last modified: May-09-2021, 10:24 PM by Yoriz.
Edit Reason: removed unnecessary quote of previous post
)
Thank you for the response, but i meant my the users with pwd.getpwall.
May-09-2021, 10:28 PM
Answers are limited by the quality of the question that's asked, please read the links in my signature.
|
|