In article <[EMAIL PROTECTED]>,
belinda thom <[EMAIL PROTECTED]> wrote:
> I've been using the following hack to determine if a type is
> acceptable and I suspect there is a better way to do it:
>
> e.g.
>
> if type(s) == type("") :
> print "okay, i'm happy you're a string"
>
> If anyone knows a better way, I'm all ears.
If you want to know whether something is specifically a string, but not a
Unicode string, then you want isinstance(foo, str). If you want to check
whether
something is a general string (including Unicode strings), you want
isinstance(foo, basestring).
hth
Ben
--
If this message helped you, consider buying an item
from my wish list: <http://artins.org/ben/wishlist>
I changed my name: <http://periodic-kingdom.org/People/NameChange.php>
--
http://mail.python.org/mailman/listinfo/python-list