How to tell the difference between string and list

Jan Kokoska kokoska.jan at globe.cz
Fri Dec 5 09:46:30 EST 2003


Hello,

I need to recognize 'var' and ['var'], usually I would use:

if a.__class__() == '':
	#string
elif a.__class__() == []:
	#list

But unfortunately in Zope PythonScripts, where I need to use this, one
is not supposed to use underscore-prefixed methods as I just found out. 

I figure this is a question general enough to post here (and not on the
Zope list), any clues?

TIA

Jan Kokoska








More information about the Python-list mailing list