Apr-26-2019, 08:56 PM
I have some code for logging in. Like most logins, I don't care about uppercase and lowercase for the username. Is there a way I can lowercase all the letters inside both usernames before comparison
Sorry I should have just looked this up before posting
Actually I have a new problem. I have this function for signing in. I can lowercase what the player types in for the username and I have a list of all the username lowercased. How do i identify the original username from the dictionary of Sign ins. Here's the code -
Sorry I should have just looked this up before posting
Actually I have a new problem. I have this function for signing in. I can lowercase what the player types in for the username and I have a list of all the username lowercased. How do i identify the original username from the dictionary of Sign ins. Here's the code -
def SignIn(): global username signInListlower = [] for i in signInList: signInListlower.append(string.lower(i)) username = input('(Type "new" for new account) Type in username: ') if username == 'new': newUsername = input('Type your Username: ') if string.lower(newUsername) in signInListlower: print('The username %s is already taken' %newUsername) SignIn() else: newPassword = input('Type your Password: ') username = newUsername print('Now return to Destination and confirm') signInList.update({newUsername : newPassword}) UserDefense.update({newUsername : 1}) UserLvl.update({newUsername : 1}) UserExp.update({newUsername : 0}) UserWeap.update({newUsername : WoodBat}) UserArmor.update({newUsername : WoodenArmor}) strUserWeap.update({newUsername : 'Wood Bat'}) strUserArmor.update({newUsername : 'Wooden Armor'}) UserPts.update({newUsername : 0}) UserExtraDamage.update({newUsername : 1}) UserAgility.update({newUsername : 1}) UserGold.update({newUsername : 50}) UserFloor.update({newUsername : 1}) for x in UserLvlListings: x.update({newUsername : False}) username = newUsername else: if string.lower(username) in signInListlower: usernameNum = signInListlower.index(lower(username)) for k in singInList: if string.lower(k) == string.lower(username): username = k password = input('Please type your password: ') if password == signInList[username]: print('Now return to Destination and confirm') else: print('Invalid Password') time.sleep(2) SignIn() else: print('Invalid Username') time.sleep(2) SignIn()If you don't understand just tell me and I'll try to explain it more thoroughly.