string bug/oddity?

Roman Suzi rnd at onego.ru
Sun Aug 12 17:07:46 EDT 2001


On Sun, 12 Aug 2001, Oktay Safak wrote:

>Hi everyboby,
>
>I am new to Python (and programming), so after reading
>and studying the tutorial by Guido last night, I
>decided to do some hands on experiments with the
>interpreter and came across a quite strange behavior.
>
>First I constructed a dictionary a. Here it is:
>
>>>> a
>{'yas': 23, 'ad': 'veli', 'soyad': 'guzel'}
>>>> for x in a.keys():
>	if type(a[x])!="string": print x+repr(a[x])
>	else: print x, a[x]


Maybe

        if type(a[x]) != type("string"): print x+repr(a[x])

will solve your problem?


Sincerely yours, Roman Suzi
-- 
_/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/
_/ Sunday, August 12, 2001 _/ Powered by Linux RedHat 6.2 _/
_/ "Is it possible to feel gruntled?" _/





More information about the Python-list mailing list