[Tutor] Type Checking:

Tim Johnson tim@johnsons-web.com
Sat, 3 Mar 2001 08:10:48 -0900


Hello:
	I need to be able to test the type of a variable:
Consider the following code:
# code begins
>>> str = 'hello'
>>> type(str)
<type 'string'>
>>> if type(str) == 'string':         
...   print "it's a string"
... else:
...   print "I don't know how to type"
... 
I don't know how to type
# code ends

How do I get this code to return 
"it's a string"

Thanks Much!!
Tim Johnson
-----------
"Of all manifestations of power,
 restraint impresses the most."
 -Thucydides