Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed6.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.029 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'append': 0.09; 'cc:addr :python-list': 0.16; 'subject:Help': 0.17; 'wrote:': 0.18; 'cc:no real name:2**0': 0.21; 'received:209.85.210.174': 0.21; 'received :mail-iy0-f174.google.com': 0.21; 'header:In-Reply-To:1': 0.22; 'dictionary': 0.23; 'cc:2**0': 0.26; 'variable': 0.28; 'message- id:@mail.gmail.com': 0.29; 'print': 0.29; 'cc:addr:python.org': 0.29; 'confused': 0.30; 'differently': 0.30; '(the': 0.30; 'values': 0.32; 'does': 0.32; 'list': 0.32; 'received:google.com': 0.37; 'received:209.85': 0.38; 'received:209': 0.39; 'more': 0.61 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=5M9kqHAWF5KPXz3BBpVhp+DjdeA4NqwNCKV+AU9DxIk=; b=pf1E+ge6HXRUPZ9jrnPQnG+nYqwXgf+Vhu/1c68aVjnSpy9+u9gXarg1w6meLDCPk1 RoFT2ZpSpmiLshYLvDZd8XJAbQOWZw+kWI0oZeraNhXR+eOg5njtWAZCur+wbd89UzOR 2hJFhqUgGZE+MrbTx78jw/XeMlGUmAg8Ie4/M= MIME-Version: 1.0 In-Reply-To: References: From: James Broadhead Date: Sun, 5 Feb 2012 15:21:18 +0000 Subject: Re: Help about dictionary append To: Anatoli Hristov Content-Type: text/plain; charset=UTF-8 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 1328455302 news.xs4all.nl 6852 [2001:888:2000:d::a6]:57050 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:19870 On 5 February 2012 15:13, Anatoli Hristov wrote: > Hi there, > > I`m again confused and its the dictionary. As dictionary does not support > append I create a variable list with dictionary key values and want to add > new values to it and then copy it again to the dictionary as I dont know > other methods. > > mydict = > {'Name':('Name1','Name2','Name3'),'Tel':('023333','037777','049999')} > dicts are intended to be used differently from this; more like: name_tel = {} name_tel['Name1'] = 023333 name_tel['Name2'] = 037777 print name_tel['Name1'] ... where Name is the key used to retrieve the value (the telephone number).