is there any way that i can use variables to change the contents of a dictionary in an executable script permanently?

I don’t understand the question, can you give an example?


k, sure
i have the following script, which i’m using to protect passwords ( i know this isnt exactly blender, but im using this to learn python for blender, plus i dunno where else to ask)

#asking for password to program
a = raw_input("Password: ")
if a == "holly":
	print("Access Granted"),
	a = 1
	print("Access Denied"),
        a = 0

#asking what to do
if a == 1:
	print("                                                                        ") 
	what = input("What do you want to do (press 1 to look up, 2 to change, and 3 to add new)")

#looking up passwords
if a == 1:
	passwords = {'hotmail': "mailaccount", 'yahoo': "mailaccount2", 'wachovia': "banking", 'weight watchers': "diet"}
	if what == 1:
		print("                                                                        ")                                                            
		account = raw_input("What account? ")

#changing passwords

if a == 1:
	if what == 2:
		print('this feature is not yet working')
		#account2 = raw_input("What account? "),
		#newpass  = raw_input("New password? "),
                #if 1 == 1:
		#	passwords['hotmail'] = newpass
		#print passwords

#adding passwords

if a == 1:
	if what == 3:
		print('this feature is not yet working')

#keeps python from closing
while True:

if you see the part where it says ‘#changing passwords’, and then you see all the “#” signs, that’s the code that i was trying to use to change the password of an account that is already in the “passwords” dictionary. the only thing is that this only changes the password temporarily, meaning that when i close the window and relaunch the file, the password for that account is back to the original.
i am wondering if there is anyway to permanently change the contents of the dictionary (besides opening it up in notepad and changing it there).

Since I guess that you do not want to edit the script when running it I would suggest saving the data in a separate file.

And I assume that you won’t actually save the passwords as in that example :wink:

if i save the passwords if another file:

  1. how can i access them?
  2. can i change another file from this script?