testing type of an object

Rajarshi Guha rajarshi at presidency.com
Fri Jun 28 14:49:34 EDT 2002


Hi,
  I'm writing some code that depends on the type of an argument
passed to it.

Is there a standard trick to do this? My versions don't seem to work:

if type(s) == 'str':
  do something

or

if string.find(type(s), 'str') != -1:
  do something

dont seem to work

TIA,



More information about the Python-list mailing list