Kent Johnson wrote:
On Thu, May 15, 2008 at 12:58 PM, GTXY20 <[EMAIL PROTECTED]> wrote:
I suspect that I need
to get a better handle on the difference between items() and iteritems() and
what situations would call for them respectively.

items() returns a list, iteritems() returns an iterator. If you don't
actually need an explicit list, iteritems() saves the cost of creating
it.

Having said that, Kent I am not 100 percent sure of what you menat when you
mention a two-level dict. Can you give me a very brief example?

Your dict d would look like this:
d={
    1: {23A:[a,b,c,d],  24A:[b,c,d]},
    2: {23A:[a,b], 24A:[a,b,c,d]}
  }


Lads...

>>> d={
...     1: {23A:[a,b,c,d],  24A:[b,c,d]},
...     2: {23A:[a,b], 24A:[a,b,c,d]}
...   }
  File "<input>", line 2
    1: {23A:[a,b,c,d],  24A:[b,c,d]},
          ^
SyntaxError: invalid syntax
>>>

Let's get a proper syntax for our data before attempting to process it.


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

Reply via email to