On 12 Dec 2005 08:26:06 -0800, Tuvas <[EMAIL PROTECTED]> wrote: > I need a function that will tell if a given variable is a character or > a number. Is there a way to do this? Thanks!
Use isinstance(). e.g.: x = 7 isinstance(x, int) -> True isinstance(x, basestring) -> False x = "Hello" isinstance(x, int) -> False isinstance(x, basestring) -> True I always use the basestring class for comparison, unless I need to know whether or not the string is unicode. -- # p.d. -- http://mail.python.org/mailman/listinfo/python-list