Hello!
I wanna check if user typed string is True or False, my program creates a new variable when the user type data.create {name} {value} and this variable is stored in a list called "data", with some script it gets the name and the value and can print using type $data.{name}.
To not make any problems or make the program more hard, it formats the string, so think that I created a data: data.create hllw Hello World and then I typed it on the console: type $data.hllw, the first thing that is executed is the formater because if it detect an $data in the string, it separates by a dot and get the name and check if the variable exists on the list. So type $data.hllw turns into type Hello World
Now, I want to make an if command, that do this: if $data.hllw == Hello World (If hllw var is "Hello World" it return True, else return False), but I don't know do this, I thinked that eval() can help, but no: if eval(args): (args = the arguments of if).
If I try:
if args:
print('True!')
else:
print('False!')
it returns always "True!" :(
Aucun commentaire:
Enregistrer un commentaire