Hi all,<br><br>I'm learning the python language and i'm trying to create a user if it is not found in the system.<br>I figured it out by doing the following thing :<br><br>>>> def finduser(user):<br>... for line in open('/etc/passwd'):<br>
... if line.startswith(user):<br>... print user, "user exists"<br>... return True<br>... return False<br><br>>>> if not finduser('myuser'):<br>
... print "Creating user myuser"<br>... os.system('/usr/sbin/useradd myuser')<br><br>But i think it's a dirty way to do so. Is there another way to manage users with python ?<br><br>Thank you :)<br>
Sam<br>