Advertisement
Guest User

Untitled

a guest
Mar 17th, 2023
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. Heres my code. I can't get it to work. I'd like to reiterate that I don't understand this solution and it is far beyond my capabilities.
  2.  
  3. ```
  4. CheckName = "user3"
  5. CheckPass = "pass3"
  6.  
  7. path = r"C:\Users\\drago\\Desktop\PythonPractice\Accounts2.txt"
  8. InFile = open(path, "r")
  9. CredentialsString = str(InFile.read())
  10. InFile.close()
  11.  
  12. import re
  13.  
  14. def check_password(check_username, check_password):
  15. for match in re.finditer(r'\[([^\[,\]]+),([^\[,\]]+)\]', CredentialsString):
  16. username, password = match.groups()
  17.  
  18. def check_password(CheckName,CheckPass):
  19. for match in re.finditer(CredentialsString):
  20. username, password = match.groups()
  21.  
  22. if (username, password) == (check_username, check_password):
  23. print('Login successful')
  24. return
  25.  
  26. print('Login unsuccessful')
  27. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement