type(x) syntax in a test

Anders Lehmann ale at usa.net
Wed Aug 23 06:12:40 EDT 2000


Bellamy Bruno <bellamy at freesurf.fr> wrote in message
news:967024838.2137696526 at news.club-internet.fr...
> Hi there...
>
> I guess my mistake is a typical beginner's one, sorry...
> But I just can't find the right syntax to make a test on a type.
>
> For instance:
>
> a = 'hello world'
> if type(a) == 'string':
> print 'glad to meet you'
>
> doesn't work...
>
> I surely missed something, but so far I can't find out what...

try type(a).__name__





More information about the Python-list mailing list