|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
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: print searchtype 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? Cheers, NiCkNaMe |
|
#2
|
||||
|
||||
|
Do this instead:
Code:
if searchtype == "substructure":
print "the search is substructure"
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.
__________________
Lucas Marshall |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > do i need to define something that a value is already defined to? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|