here’s the code for the file writer:
def createAccount():
while True:
username = input("Create your username: ")
password = input("Create your password: ")
if username.isspace() == True or password.isspace() == True and len(username) <= 3 or len(password) < 10:
print("the username or password does not meet the requirements. Please try again.")
continue
break
userid = random.randint(1000000, 9999999)
Udata = {
username:
{
"userid": userid
}
}
data = {
"password": password,
"last_logged_in": 0,
"high_score": 0,
"rage_quit_last_time": False
}
json.dump(Udata, open(accountsDir, 'a'), indent=3)
os.makedirs("accounting/UserData/" + str(userid), exist_ok=True)
open("accounting/UserData/" + str(userid) + "/data.json", "w")
open("accounting/UserData/" + str(userid) + "/scores.json", "w")
scoresFile = "accounting/UserData/" + str(userid) + "/scores.json"
Datafile = "accounting/UserData/" + str(userid) + "/data.json"
json.dump(data, open(Datafile, 'w'), indent=3)
print("Account Created. your username is: ", username + ". You can now play the fukin game.")
return username, password
and the json file after 2 accounts have been made.
{
"test1": {
"userid": 9146500
}
}{ //why do this?
"test2": {
"userid": 7593340
}
}