type(x) syntax in a test
Ruediger
ruediger.maehl at web.de
Wed Aug 23 06:31:22 EDT 2000
Use:
import types
if type(a) == types.StringType:
Or use:
if type(a) == type('x'):
Ruediger
Bellamy Bruno schrieb in Nachricht
<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...
More information about the Python-list
mailing list