how add path to open()

28 megtekintés
Ugrás az első olvasatlan üzenetre

Dariusz Mysior

olvasatlan,
2014. nov. 29. 14:35:312014. 11. 29.
– django...@googlegroups.com

I join to topic with my problem

I want to create new file with login and password in new file and I can do it with code below, but I don't know how save this new files in one folder users

def rejestracja(login, haslo): save=None login_tmp=login haslo_tmp=haslo save={login_tmp:haslo_tmp}

 filehandler
=open(login,"wb")
pickle
.dump(save,filehandler)
filehandler
.close()
filehandler
=open(login,"rb")
file
=pickle.load(filehandler)
filehandler
.close()
print file
raw_input
("\n\nWcisnij [ENTER]: ")

Collin Anderson

olvasatlan,
2014. nov. 30. 14:24:442014. 11. 30.
– django...@googlegroups.com
Hi,

I think you want something like this. (Just make sure a login name doesn't have '..' in it :).

filehandler = open('users/' + login, "wb")

Collin

Dariusz Mysior

olvasatlan,
2014. nov. 30. 23:48:442014. 11. 30.
– django...@googlegroups.com
Yes this is it :)

thanks :)
Válasz mindenkinek
Válasz a szerzőnek
Továbbítás
0 új üzenet