How to determine an object is "scriptable"
bruno at modulix
onurb at xiludom.gro
Thu Mar 30 17:00:15 CEST 2006
> I recently came across a problem where I saw this error:
> "TypeError: unsubscriptable object"
> How can I determine if an object is "scriptable" or "unscriptable"?
By trying to apply the subscript operator ('[<index>]'). If it raises a
TypeError, then it's not subscriptable.
But, as Larry Bates already pointed out, your real problem is a logic
error: you get an unsubscriptable object where you assumed you had a
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"
More information about the Python-list