0

I am working on a project called password manager,for that i need to store the passwords and emails and i need to access password whenever user type a corresponding email i am trying to store them in a json file ,but iam unable to store user input to a json file

if choice=="A":
    Email = input("Enter your email..")
    password = input("Enter your password..")

    manager = """{
        "email":Email
        "password":"password"
    }"""

This is the code that i have written

1
  • 1
    If you store the email and password in a dict, then it should be very easy to output to a json file using the json module: docs.python.org/3/library/json.html Commented May 16, 2020 at 16:03

1 Answer 1

1

Use the json module

import json

if choice == "A":
    email = input("Enter your email: ")
    password = input("Enter your password: ")

    manager = {
        "email": email,
        "password": password
    }

    with open("file.json", "w") as file:
         json.dump(manager, file)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.