Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding:Latin-1 -*
- # Importer les module utilisé
- import os
- import json
- import subprocess
- # Détection des chemin
- dossier_courant = os.path.dirname(__file__)
- chemin_dictionnaire = os.path.join(dossier_courant, "connexion.json")
- # Création du dictionnaire
- if os.path.exists(chemin_dictionnaire):
- with open(chemin_dictionnaire, "r") as f:
- dictionnaire_connexion = json.load(f)
- else:
- dictionnaire_connexion = {}
- # Création de l'affichage
- affichage = """
- \t1:Connexion
- \t2:Inscription
- \t3:Sauvegarder votre inscription
- \t4:Terminer
- """
- option = "0"
- while option != "4":
- option = input(affichage)
- if option == "1":
- nom = input("Quel est votre nom ? : ")
- prenom = input("Quel est votre prénom ? : ")
- mdp = input("Quel est votre mot de passe ? : ")
- if mdp == dictionnaire_connexion[nom + prenom]:
- print("vous ete maintenant connecter ! ")
- affichage2 = """
- \t1: Ouvrir liste de course
- \t2: quitter
- """
- option2 = "0"
- while option2 != "2":
- option2 = input(affichage2)
- if option2 == "1":
- chemin_liste = "C:/Users/bastien/Documents/projet python/formation udemy/TP_liste de course.py"
- chemin_python = "C:/Users/bastien/AppData/Local/Programs/Python/Python37/python.exe"
- subprocess.run(chemin_liste, shell=True, check=True)
- else:
- print("Vous n'ete pas enregistré ")
- elif option == "2":
- nom = input("Quel est votre nom ? : ")
- prenom = input("Quel est votre prénom ? : ")
- mdp = input("Quel est votre mot de passe ? : ")
- dictionnaire_connexion[nom + prenom] = mdp
- elif option == "3":
- with open(chemin_dictionnaire, "w") as f:
- json.dump(dictionnaire_connexion, f)
- with open(chemin_dictionnaire, "w") as f:
- json.dump(dictionnaire_connexion, f)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement