How to store user input as a variable and compare it to already existing variables | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

8th Jun 2020, 4:28 PM
FlyiiingDani
FlyiiingDani - avatar
4 Answers
+ 1
Have you tried using vars()?
8th Jun 2020, 4:43 PM
Valmob101
Valmob101 - avatar
+ 1
For example: # input is ab vars()[input()] = 1234 print(ab) #Output will be 1234
8th Jun 2020, 4:53 PM
Valmob101
Valmob101 - avatar
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
8th Jun 2020, 4:52 PM
FlyiiingDani
FlyiiingDani - avatar
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.
8th Jun 2020, 5:01 PM
FlyiiingDani
FlyiiingDani - avatar