> For example, I have a dictionary:
> dict1 = { 0x2018:u'k', 0x2019:u'd'}
>
> I assign:
> n = 0x2018
> print dict1[n]
>
> Then:
> KeyError: '0x2018'
The error is complaining that you are using a string as a key.
Are you sure you aren't assigning
n = '0x2018'
Alan G
Author of the learn to progr
kakada wrote:
> I assign:
> n = 0x2018
> print dict1[n]
>
> Then:
> KeyError: '0x2018'
>
Notice the error menstions a *string*. You probably mistyped it, not in
the email, but in your actual program.
Hugo
___
Tutor maillist - Tutor@python.org
http
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
On Tue, 2006-04-11 at 22:37 -0500, Jason Massey wrote:
> Works for me:
>
> >>> dict1 = { 0x2018:u'k', 0x2019:u'd'}
> >>> n = 0x2018
> >>> print dict1[n]
> k
> >>>
>
> On 4/11/06, kakada <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> For example, I have a dictionary:
>
Works for me:>>> dict1 = { 0x2018:u'k', 0x2019:u'd'}>>> n = 0x2018>>> print dict1[n]k>>> On 4/11/06,
kakada <[EMAIL PROTECTED]> wrote:
Hello all,For example, I have a dictionary:dict1 = { 0x2018:u'k', 0x2019:u'd'}I assign:n = 0x2018print dict1[n]Then:KeyError: '0x2018'But I can call directly:print