[Tutor] Help with basic user-data file

Rob Andrews rob.andrews at gmail.com
Thu Oct 12 15:25:19 CEST 2006

To keep the information, the simplest solution is simply to save it in
a text file that the program can load into memory when it starts up
again. For sensitive information like passwords, a little extra fuss
is generally merited.

When someone logs in, you can save a value like
time.strftime(time.ctime()) for a nice, human-readable time stamp.
Don't forget to "import time" first.

-Rob A.

On 10/12/06, Asrarahmed Kadri <ajkadri at googlemail.com> wrote:
> Folks,
> I am trying to modify the userManagement program given in Core Python
> Programming. It uses a dictionary to store user-password information. The
> usernames are the keys and the passwords are the values.
> Now I want is to add a third element; last login time.
> I want to store this information in a file so that the data is not lost once
> the program stops execution.
> I am not sure of using time function in python..
> Can anyone help with this issue??

More information about the Tutor mailing list