Testing for a list
brian at sweetapp.com
Mon Mar 10 20:19:40 CET 2003
> Thanks Brian
> That's exactly what I needed.
> Why were people ignoring my question? What was wrong about it?
It shouldn't matter to you what type something is, as long as its
behavior is consistent with what you expect. But, to be quick and dirty,
I'd use this construction:
if isinstance(a, types.StringTypes):
# do string code path
# do list code path
More information about the Python-list