Need help for this programme

i wrote a programme which has login,create account in it.if login details are correct it will open the webpage.create accounts and adds to dictionary if account is not created already.how to add those created details into dictionary permanently so that when i exit and come back it must be there saved in dictionary .

Make a file (best would be a .json-File) and store it next to your programm. Write user-details to it. Everytime you need to check the user you can read the data in the file. New data you can write to that file too.

1 Like

Or use SQLite for the same thing? Many phone apps use this approach I believe.

Yes, that would be a good thing. Especially for a Web App there you want to store a lot more things as just the username.

My limited exposure to things like Rails, tend to handle these scenarios out of the box as they are so common.

In fact, most Rails or Django tutorials I’ve seen tend to involve creating a web store, which inevitably has a login process. I think Rails uses SQLite and YAML for config. Perhaps consider using one of these web frameworks might achieve a quicker more reliable solution, unless you are trying to handcraft the thing for practice.

1 Like

Hey @hemanth I believe you want this module:

https://docs.python.org/3/library/pickle.html

You just convert your dict into a byte stream using pickle then save it to a file. There’s lots of examples in that document. You then just load it up using the reverse process.

2 Likes