string bug/oddity?
Peter Hansen
peter at engcorp.com
Sun Aug 12 19:45:15 EDT 2001
Oktay Safak wrote:
>
> First I constructed a dictionary a. Here it is:
>
> {'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]
>
>
> yas23
> ad'veli'
> soyad'guzel'
>
> I just want to concatenate the two strings without the
> quotes as in the last line.
Anything wrong with this, simpler, approach?
>>> for x in a.keys():
... print '%s%s' % (x, a[x])
--
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com
More information about the Python-list
mailing list