So basically, I have a python program but there's a point in which I need help. When the user input the variable name, I want it to print the variable value, not the variable name, even if the variable doesn't exist. This is what I've currently got:
CMD = input(">>>> ")
if CMD[0:17] == "console.printVar(" and CMD[-1:] == ")" and CMD[-2:]!="')":
try:
CMD[13:-1]
except NameError:
print("Variable "+CMD[13:1]+" Not defined")
Main()
else:
print(CMD[17:-1])
Main()
Oh, and just in case it's not clear, i'm sort of working on a coding language sort of thing.