30 lines
756 B
Python
30 lines
756 B
Python
#!/usr/bin/python3
|
|
|
|
import sys
|
|
|
|
#print ("Nom du programme : ", sys.argv[0])
|
|
#print ("Nombre d'arguments: ", len(sys.argv))
|
|
#print ("Les arguments sont : " , str(sys.argv))
|
|
|
|
if len(sys.argv) != 2:
|
|
msg= ("Usage : " + sys.argv[0] + " <fichier.txt>")
|
|
print(msg ,file=sys.stderr)
|
|
sys.exit(1)
|
|
|
|
filename = sys.argv[1]
|
|
try:
|
|
file= open(filename , "r")
|
|
except:
|
|
msg = ("Erreur ouverture fichier " + filename)
|
|
print(msg ,file=sys.stderr)
|
|
|
|
else:
|
|
line = file.readline()
|
|
linee = line.rstrip()
|
|
while linee:
|
|
(login, complet) = linee.split(":")
|
|
print (login, " ",complet)
|
|
line = file.readline()
|
|
linee = line.rstrip()
|
|
file.close()
|