사전 항목을 변수에 저장하는 것이 가능한지 궁금합니다. 그래서 이것은 단순히 내가하는 일입니다. 나는 사전에이 항목을 저장하고있다 :사전 항목을 변수로 설정
accounts{}
def accountcreator():
newusername = raw_input()
newpassword = raw_input()
UUID = 0
UUID += 1
accounts[newusername] = {newpassword:UUID}
을 이제 기본적으로 내가 별도의 함수에서 newusernames 통해 반복 될 것이다 : 나는 혼란스러워 곳
def accounts():
username = raw_input()
for usernames in accounts:
if usernames == username:
#Not sure what to do from here on out
else:
accounts()
이입니다. 따라서 사용자 이름 입력이 계정 사전에있는 새 사용자 이름과 같으면 계속해서 연결됩니다. 그 newusernames 암호와 UUID ({newpassword : UUID} 부분)를 변수에 저장하겠습니다. 기본적으로 newusername이 사용자 이름 입력과 같으면 나머지 정보 ({newpassword : UUID})를 변수에 저장합니다. 결국 결국 변수는 accountinfo = {newpassword : UUID}이라고 말할 수 있습니다. 고마워요, 그 말이 맞는 것 같아요.
'accountinfo = accounts [username]'을 사용하면됩니다. 파이썬 튜토리얼을 읽어보십시오. – user3885927
그러면 UUID도 어떻게 얻을 수 있습니까? 또는 이것이 UUID 인 경우 어떻게 암호를 얻을 수 있습니까? 감사합니다. –