0

So I was creating a Register/Login in python. I did mostly of it but I can't seem to find a correct answer over here

def DisplayMenu():
status = input("If you have an account type in 'log' or to make an account type in 'reg': ")
if status.lower() == "reg":
    RegisterUser()
if status.lower == "log":
    LogIn()   I need help in this part

This is the base

def LogIn():
ToLogIn = open('Ustore.txt', 'r')

I created this and I was stuck from here.

The problem basically is that, this function would open the text file and search the username and password in it. I can't seem to find a specific code to command it to find it and then complete the whole action by allowing the user, upon typing his password and username and grant him access. Please help!

  • this is a discussion blog. You can try to solve the problem and if you are stuck with errors in code most of us will help to rectify it. please try something and let us know if you are hitting on exception – Myjab Oct 13 '18 at 15:07
  • I'm not sure exactly what you are asking, but it looks a lot like this question: https://stackoverflow.com/questions/46738966/how-to-check-text-file-for-usernames-and-passwords – Stuart Oct 13 '18 at 15:24

1 Answers1

0

The reason why your code isn't executing the way you expect it to be is because you have a typo error on line 5 in the way you have called lower function which is without parenthesis (I believe its typo because on line 3 you have it correct), it is as mentioned below

if status.lower == "log":

Whereas, It should be

if status.lower() == "log":

Functions and methods in Python are also objects themselves. You aren't actually calling the method when you enter status.lower without the parenthesis at the end. You're just referencing the object associated with the method.

sulabh chaturvedi
  • 3,608
  • 3
  • 13
  • 25