你好,我有点挣扎在这个python代码。基本上,我想让用户输入两个用户,用户1和用户2,他们都有密码(我希望密码是散列/加密的),但我不知道怎么做。
这是我的密码
#Asks for login
gameuniqueid = random.randint(1000,999999)
player1uniqueid = random.randint(1000,9999)
player1 = input("Enter player 1 name: ")
p1p = input("Enter/Create player 1 password: ")
p1_final_score = 0
player2uniqueid = random.randint(1000,9999)
player2 = input("Enter player 2 name: ")
p2p = input("Enter/Create player 2 password: ")
p2_final_score = 0
print("Your game unique ID is:", gameuniqueid )
#Opens Files and enters information
game = []
user1 = []
user2 = []
file = csv.writer(open("database.csv", "a"))
rows.append(["Game id: ", gameuniqueid])
rows.append([player1uniqueid ,player1, p1p, p1_final_score])
rows.append([player2uniqueid ,player2, p2p, p2_final_score])
file.writerows()
所以需要的是csv文件中的每个游戏都有:
第1行:唯一ID:(游戏唯一编号)
第2行:第1列:P1用户名第2列:P1密码第3列:P1_最终得分
第3行:第1列:P2用户名第2列:P2密码3:P2最终得分
第4行:无
每次有人输入用户名和密码时,我都希望有一个这样的长列表。然后它将被添加到.csv中,就像我想要的那样,这样人们就可以查看他们的分数和详细信息。
我真的希望有人能帮助我,因为我有点挣扎。如果这没什么意义,请告诉我。
https://codeshare.io/G6oBZN
或者你只是想看看
https://pastebin.com/hdKFJj6s