[Tutor] Help with basic user-data file

Rob Andrews rob.andrews at gmail.com
Thu Oct 12 15:53:56 CEST 2006


When a login name is being created, you can pull a list of existing
login names from file, and run a check to see if it is in the list. If
the new name is in the list, have it kick back a message telling the
user to try another name.

Also, your program could suggest a new user name in such a case, or
even assign new users names of its choosing.

The dictionary data structure is handy for the program to use in very
efficiently matching user names with passwords. But you don't have to
store the dictionary in a file as a dictionary. It's possible to do
so, but often easier to use a delimited text file.

On 10/12/06, Asrarahmed Kadri <ajkadri at googlemail.com> wrote:
> It means there is no need of entering the data in the dictionary,??
>
> How will I then implement the uniqueness of loginnames???
>
> Thanks for the support.
> regards,
> Asrar
>
>
> On 10/12/06, Rob Andrews <rob.andrews at gmail.com> wrote:
> >
> > 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??
> > _______________________________________________
> > Tutor maillist  -   Tutor at python.org
> > http://mail.python.org/mailman/listinfo/tutor
> >
>
>
>
> --
> To HIM you shall return.


-- 
Blogging my outdoors obsession: http://trekkingbob.blogspot.com/


More information about the Tutor mailing list