import os CHAR_ID = "#" CHAR_NEW_LINE = "\n" my_id = "" prenom = "" nom = "" age = "" def demande_info(): global my_id, prenom, nom, age my_id=raw_input("Veuillez introduire un ID :") prenom=raw_input("Veuillez introduire votre prenom :") nom=raw_input("Veuillez introduire votre nom :") age=raw_input("Veuillez introduire votre age:") def select_dossier(nom_dossier): #si le dossier n'existe pas on le cree if not os.path.isdir(nom_dossier): os.mkdir(nom_dossier) os.chdir(nom_dossier) def ajoute_au_fichier(): my_file = open("data_base.txt","a") my_file.write(CHAR_ID) my_file.write(my_id) my_file.write(CHAR_ID + CHAR_NEW_LINE) my_file.write(prenom + CHAR_NEW_LINE) my_file.write(nom + CHAR_NEW_LINE) my_file.write(age + CHAR_NEW_LINE) my_file.write(CHAR_NEW_LINE) my_file.close() demande_info() select_dossier("data") ajoute_au_fichier()