How to store user input as a variable and compare it to already existing variables | Sololearn: Learn to code for FREE!

0

How to store user input as a variable and compare it to already existing variables

Hello, im trying to programm a bank system with python using PyQt5 and SQLite3. I designed my GUI and transformed it into a python file. But now i dont know how to store the user input from the LineEdit area as a variable, Because i need to compare them to the already existing Datas and then logging in if they are correct. I hope its clear what i want to say. Thank you! These are the codes. One is for the GUI and the other to connect buttons etc. To the functions. https://code.sololearn.com/cKtXZw5U21zu/?ref=app https://code.sololearn.com/cHX09nvGVq6S/?ref=app

6/8/2020 4:28:07 PM

FlyiiingDani

4 Answers

New Answer

+1

Have you tried using vars()?

+1

For example: # input is ab vars()[input()] = 1234 print(ab) #Output will be 1234

0

Doesn't vars() only return variables if they are given? But in my case i need to store them first in variables, or not? Maybe you could explain to me, how to use it

0

If i understand you right, with vars() i can assign a variabel a new value? I will take a look if this will work and how i can apply it at my code.