Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'win32': 0.03; 'iterate': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'jan': 0.12; 'dict': 0.16; 'igor': 0.16; 'iterable': 0.16; 'typeerror:': 0.16; 'wrote:': 0.18; 'all,': 0.19; 'bit': 0.19; 'cc:addr:python.org': 0.22; 'print': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; '"",': 0.31; '>>>>': 0.31; 'file': 0.32; '(most': 0.33; 'subject:with': 0.35; 'received:google.com': 0.35; '14,': 0.36; 'doing': 0.36; 'hi,': 0.36; 'pm,': 0.38; 'recent': 0.39; 'more': 0.64; 'to:addr:gmail.com': 0.65; '2013,': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=9va49JaGlDZk+T2zI7koDF/7ISrSEozVdUbR7JyV8/4=; b=tZUUmBrXg2z/wZmMksdqjUG9VcN4blBl4DYXlGSwpwrc7cuVNp5J49xQutyeRYbDw7 DAx23dIc4vnYEj9IosZhMbK3A90NB/s66sIx/rqWJbHiC1NmC3KxSPG2xsN7VW1RZZL7 KZRPImDJcP0uZaGKCqEiuJYl09n+AYV/LPUnALakxWiI7qTqoXMLJyYznlsH9iFZ53dN u3w+pJluasP8f18IDZ09PoX0AYJ6P6AyD1AwHoBM9kJODJGcWxuI+c1nG+DoSXL8HoFf MKlbqlfBzCDNkCuHCkwxBI9E4aVogtt3Bj5yc6nKrSevmC41zdgz/onQOHm7dHih6Rpm SEKQ== MIME-Version: 1.0 X-Received: by 10.180.211.101 with SMTP id nb5mr1261145wic.0.1389734143278; Tue, 14 Jan 2014 13:15:43 -0800 (PST) In-Reply-To: References: Date: Tue, 14 Jan 2014 14:15:43 -0700 Subject: Re: dictionary with tuples From: Larry Martell To: Igor Korot Content-Type: text/plain; charset=UTF-8 Cc: "python-list@python.org" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1389734151 news.xs4all.nl 2909 [2001:888:2000:d::a6]:39733 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:63939 On Tue, Jan 14, 2014 at 2:10 PM, Igor Korot wrote: > Hi, ALL, > C:\Documents and Settings\Igor.FORDANWORK\Desktop\winpdb>python > Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit > (Intel)] on win32 > Type "help", "copyright", "credits" or "license" for more information. >>>> dict = {} >>>> dict[(1,2)] = ('a','b') >>>> dict[(3,4)] = ('c','d') >>>> for (key1,key2),(value1,value2) in dict: > ... print key1, " ", key2 > ... print value1, " ", value2 > ... > Traceback (most recent call last): > File "", line 1, in > TypeError: 'int' object is not iterable >>>> > > What am I doing wrong? You need to iterate over dict.items()