Jonasboz107

Python Username And Password system

Oct 17th, 2020 (edited)
982
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Username-Password System (Username and Password input and saving here)
  2. #name = input('Username: ')
  3. #pas = input('Password: ')
  4.  
  5. #with open('username.txt', 'w') as usernametxt:
  6. #    usernametxt.write(name)
  7.  
  8. #with open('password.txt', 'w') as passwordtxt:
  9. #    passwordtxt.write(pas)
  10.  
  11.  
  12. inputName = input('LoginUsername: ')
  13.  
  14. with open('username.txt', 'r') as usernametxt2:
  15.     username = usernametxt2.read()
  16.  
  17. with open('password.txt', 'r') as passwordtxt2:
  18.     password = passwordtxt2.read()
  19.  
  20. if inputName == username:
  21.     inputPass = input('LoginPassword: ')
  22.     if inputPass == password:
  23.         print('Welcome!')
  24.  
  25. if inputName != username:
  26.     print('Wrong Username')
  27.     quit
  28.  
  29. if inputPass != password:
  30.     print('Wrong Password')
  31.     quit
  32. #I would recommend making a username.txt with your username in it and a password.txt #with your password in it so you dont have to use
  33.  
  34.  
  35.  
  36. #name = input('Username: ')
  37. #pas = input('Password: ')
  38.  
  39. #with open('username.txt', 'w') as usernametxt:
  40. #    usernametxt.write(name)
  41.  
  42. #with open('password.txt', 'w') as passwordtxt:
  43. #    passwordtxt.write(pas)
  44.  
  45.  
  46.  
  47. #Also make sure those files are in the same folder as the main.py or whatever you #named your python file.
  48.  
  49. #Code could probably be simplified but I'm new to coding so I wouldn't know how to to #that
RAW Paste Data