How to tell the difference between string and list

Skip Montanaro skip at pobox.com
Fri Dec 5 09:57:56 EST 2003


    Jan> I need to recognize 'var' and ['var'], usually I would use:

    ...

Try

    if isinstance(a, str):
        pass
    elif isinstance(a, list):
        pass

Skip





More information about the Python-list mailing list