python - Dictionaries inside a dictionary -


I'm trying to put the dictionary inside a big dictionary to create a log system

  if (OS path.exists ('Users.dat')): Open with ('Users.dat', 'rb') f: users = pickle.load (f) f.close () done = False while not (done): userin = input ('username:') passin = input ('password:') if word in userin: user name = user [userin] ['user name'] password = user [userin ] ['Password'] Other: break  

when I do this, it :

  Username: JTomkins12 Password: 4621 Traceback (Last Call Last): File "C: \ User \ Jam \ Lesson \ Computing \ Aptana Studio Workspace \ Full Program \ FullProgram .py ", line 274, & lt; Module & gt; Loginmenu (like) File "C: \ User \ Jam \ Lesson \ Computing \ Aptana Studio Workspace \ full program \ fullprogram \", in the line menu, in the login menu if userin: type type: type 'type' argument is not aarti  

Can anyone help me fix this?

Again ask that the username dict is in the constructor type.

You want

  if user in user: ...  

To be consistent with the style guide, Should use the lowercase name, and the capitalized first letter name for class names should be reserved.

It is generally considered to be more pyothic to use the dict instead (instead of examining it, if permission is permitted by permission of the principle is easy to apologize), instead of checking. () , but what you are doing is a bit more complicated, so I'm not going to be important.


Comments