[Tutor] dictionary datatype

kakada hokkakada at khmeros.info
Wed Apr 12 12:20:18 CEST 2006


It also works for me now:)

First i tried it with Konsole in Kate and it's not working.
It sometimes happen with assignment statement:

i += 1 (not working)
i+=   1(working)

but later on I tested it again and both are working.

Thanks for your help, though.

da




Jason Massey wrote:
> Works for me:
>
> >>> dict1 = { 0x2018:u'k', 0x2019:u'd'}
> >>> n = 0x2018
> >>> print dict1[n]
> k
> >>>
>
> On 4/11/06, * kakada* <hokkakada at khmeros.info
> <mailto:hokkakada at khmeros.info>> wrote:
>
>     Hello all,
>
>     For example, I have a dictionary:
>     dict1 = { 0x2018:u'k', 0x2019:u'd'}
>
>     I assign:
>     n = 0x2018
>     print dict1[n]
>
>     Then:
>     KeyError: '0x2018'
>
>     But I can call directly:
>     print dict1[0x2018]
>
>     So, what is wrong with this? How can I solve it?
>
>     Thx
>
>     kakada
>     _______________________________________________
>     Tutor maillist  -  Tutor at python.org <mailto:Tutor at python.org>
>     http://mail.python.org/mailman/listinfo/tutor
>
>



More information about the Tutor mailing list