[Tutor] KeyError: '61.135.168.82' with dictionary.

Andreas Kostyrka andreas at kostyrka.org
Thu Mar 25 16:36:19 CET 2010


Am Donnerstag, 25. März 2010 13:31:07 schrieb Hugo Arts:
> On Thu, Mar 25, 2010 at 12:24 PM, Ray Parrish <crp at cmc.net> wrote:
> > As you can see, it is tossing a key error on the same ip address that was
> > used in the interactive code successfully,
> >
> > I can not figure out what to change to make the script work. Does someone
> > know why this happens?
> 
> It's impossible to tell for sure from just that snippet, but my first
> guess would be that the if statement is not actually executed. Put a
> print statement in there and check if you're really executing what you
> think you're executing.

Actually the snippet looks like it should be executed in a loop.

If so, the code destroys the dictionary for each new entry, I'd say.

Andreas

> 
> Hugo
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
> 


More information about the Tutor mailing list