I'm working on a simple "sign in " "sign up" program, and the idea is that the user inputs a username and a password and they get saved in a python file named Database. And the sign in process works the same, but I'm stuck in the step where the program should import a class named after the username that has the password in it, and to import this class the user should input its name (username) so at first it will be just a variable and later it will be defined. I'm still a beginner in python and this is my idea as a code:
#This is the file named Database class Username: password = ["Mypassword"] #This is the sign in program user = input("enter your username:\n") with open('Database.py') as file: content = file.read() if user in content: from Database import user else: print("this username is not in the database") in the console it shows that "user" is not defined because it's a variable, so is there any other way to achieve the same goal with another function or something. This is the best I can think of as a beginner perhaps if someone has a better idea let me know please.
importmakes it sound like it means something different to you than it does topython. Please update your knowledge by referring to the documentation or some tutorials.