Re: Using tuples to eliminate multiple dict values

2011-09-16 Thread Tim Chase
On 09/16/11 13:47, Benshep wrote: I need a dictionary that returns the same value for multiple keys. i.e. (1)>>> dict = { (1,2,3) : 'text' , (5,6,7) : 'other text' } (2)>>>dict[1] (3) 'text' I cant figure out what i need on line 2 to make this scenario work. Is there a simple way to check i

Re: Using tuples to eliminate multiple dict values

2011-09-16 Thread Chris Angelico
On Sat, Sep 17, 2011 at 4:47 AM, Benshep wrote: > (1)   >>> dict = { (1,2,3) : 'text' , (5,6,7) : 'other text' } > As I understand it, you're looking for a simple syntax for what MRAB posted: > my_dict = {1: 'text', 2: 'text', 3: 'text', 5: 'other text', 6 : 'other > text', 7: 'other text'} Sin

RE: Using tuples to eliminate multiple dict values

2011-09-16 Thread Prasad, Ramit
-Original Message- From: python-list-bounces+ramit.prasad=jpmorgan@python.org [mailto:python-list-bounces+ramit.prasad=jpmorgan@python.org] On Behalf Of Benshep Sent: Friday, September 16, 2011 1:48 PM To: python-list@python.org Subject: Using tuples to eliminate multiple dict val

Re: Using tuples to eliminate multiple dict values

2011-09-16 Thread Benshep
thanks, I had a feeling that may be the way to go and my data just changed so it will work better that way. Thanks for the quick reply -- http://mail.python.org/mailman/listinfo/python-list

Re: Using tuples to eliminate multiple dict values

2011-09-16 Thread MRAB
On 16/09/2011 19:47, Benshep wrote: I need a dictionary that returns the same value for multiple keys. i.e. (1)>>> dict = { (1,2,3) : 'text' , (5,6,7) : 'other text' } That will create a dict with 2 keys, both of which are tuples. (2)>>>dict[1] (3) 'text' I cant figure out what i need o