>I am trying to make my way through a book on Python ("Python 
>Ptogramming for
> the Absolute Beginner") and have run into some code in the book (and 
> on the
> author's accompanying CD) that won't work.  I suspect that it might 
> be
> because my version of Python is too old (2.1).

Your diagnosis is correct.
The in operator didn't work on dictionaries until 2.3 (I think)
It did work on lists/tuples and it worked for single characters in 
strings
(but not for substrings). By 2.43 both of the abiove failings had been 
fixed.

But you can fix it in this case easily enough:

> if "Dancing Baloney" in geek:

   if "Dancing Baloney" in geek.keys():

Should work.

Alan G. 


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to