repl.it
@BenjaminSMITH69/

user check3

Python

No description

fork
loading
Files
  • main.py
  • users.txt
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
info = {}                                                            

with open('users.txt', 'r') as f:                                      
    for line in f: 
        username, delim, password = line.strip().partition(':')                        
        info[username] = password.split(';')   
while True:                                 
    username = input("Please enter your username: ")                    
    if username in info:                                          
        while True:
            password = input("Please enter your password: ")      
            if password == info[username][0]:
                print ("Logged in successfully as " + username)         
                break
            elif password in info[username]:                         
                print ("Specific error message " + username)            
            else:
                print ("Password incorrect!")
        break
    else:
        print ("Username incorrect!")
?