daily pastebin goal
66%
SHARE
TWEET

Untitled

a guest May 23rd, 2018 1,673 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. username = raw_input("Username: ")
  2. password = raw_input("Password: ")
  3.  
  4. login = open("login.txt", "r")
  5.  
  6. for line in login:
  7.     if line.split(":")[0] == username and line.split(":")[1] == password:
  8.         print("It Works!")
  9.     else:
  10.         print("Failed")
  11.    
  12. admin:password
  13. nimda:drowssap
  14.    
  15. # I added the 'with' clause so that the file is opened fresh each run
  16. # (for debugging - the file cursor is iterated each time a line is read)
  17. with open("login.txt", "r") as login:
  18.     lines = login.readlines()
  19.  
  20. for line in lines:
  21.     if line.strip().split(":")[0] == username and line.strip().split(":")[1] == password:
  22.         print("It Works!")
  23.     else:
  24.         print("Failed")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top