#!/usr/bin/python3 import sys if len(sys.argv) != 2: print("usage: ", sys.argv[0], "") sys.exit(1) # nombre de parametre invalide filename = sys.argv[1] try: file = open(filename , "r") except: msg = "erreur ouverture fichier " + filename print(msg, file=sys.stderr) else: line = file.readline() maligne = line.rstrip() while maligne: (login, complet) = maligne.split(":") print (login) print (complet) commande="useradd --create-home --home-dir /home/"+login+ " --shell /bin/bash --comment \"" + complet + "\" " + login login = [] line = file.readline() maligne = line.rstrip() print(line) file.close()