Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #63938

dictionary with tuples

Date 2014-01-14 13:10 -0800
Subject dictionary with tuples
From Igor Korot <ikorot01@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.5476.1389733811.18130.python-list@python.org> (permalink)

Show all headers | View raw


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 "<stdin>", line 1, in <module>
TypeError: 'int' object is not iterable
>>>

What am I doing wrong?

Thank you.

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

dictionary with tuples Igor Korot <ikorot01@gmail.com> - 2014-01-14 13:10 -0800
  Re: dictionary with tuples YBM <ybmess@nooos.fr.invalid> - 2014-01-14 22:21 +0100
    Re: dictionary with tuples Tobiah <toby@tobiah.org> - 2014-01-14 14:00 -0800
      Re: dictionary with tuples emile <emile@fenx.com> - 2014-01-14 14:14 -0800
      Re: dictionary with tuples YBM <ybmess@nooos.fr.invalid> - 2014-01-15 03:24 +0100

csiph-web