On 2006-11-29, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Leandro Ardissone wrote:
>> Hi,
>>
>> I want to know what type is a variable.
>> For example, I get the contents of an xml but some content is a list or
>> a string, and I need to know what type it is.
>
> You should try to treat it as a list, catch the exceptions raise when
> it is a string (problably ValueError, TypeError ou Attribute error,
> depends on what are you doing),

As you said, it depends on what he's doing.  The problem is
that strings act a lot like lists, and if he's using the subset
of list characteristics that are implimented by strings, there
won't _be_ an exception -- just wrong results.

In the past, I've almost alwasy had to look before I leap when
dealing with both strings and lists.

-- 
Grant Edwards                   grante             Yow!  How's it going in
                                  at               those MODULAR LOVE UNITS??
                               visi.com            
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to