March 12th, 2002, 10:27 AM
do i need to define something that a value is already defined to?
I have a cgi and i have managed to get the radio buttons working, and can print their value. Eg the button is searchtype and it's value could be substructure.
So when I write:
substructure is printed.
However if I type:
if searchtype == substructure:
Print "the search is substructure"
I get an error saying that substructure is not defined, how do I get around this does anyone know?
March 13th, 2002, 06:07 PM
Do this instead:
If you don't have quotes around "substructure," Python thinks that it is a variable name and tries to look up the value of it to compare with the value of searchtype. As there is no variable "substructure" defined, you get an error. Putting quotes around it makes it a string literal.
if searchtype == "substructure":
print "the search is substructure"