You could use my mseqdict implementation of a sorted dict.
http://home.arcor.de/wolfgang.grafen/Python/Modules/Modules.html
swap:
This method can only be applied when all values of the dictionary are
immutable. The Python dictionary cannot hold mutable keys! So swap
doesn't work if only one of
Paul McGuire <[EMAIL PROTECTED]> wrote:
> Instead of all that try/except noise, just use the new defaultdict:
>
> >>> from collections import defaultdict
> >>>
> >>> d = {'a' : 1, 'b' : 3, 'c' : 2,'d' : 3,'e' : 1,'f' : 4}
> >>>
> >>> dd = defaultdict(list)
> >>> for key, value in d.items():
> ..
In article
<[EMAIL PROTECTED]>,
Paul McGuire <[EMAIL PROTECTED]> wrote:
> On Jun 12, 6:41 am, David C. Ullrich <[EMAIL PROTECTED]> wrote:
> > On Thu, 12 Jun 2008 03:58:53 -0700 (PDT), Nader <[EMAIL PROTECTED]>
> > wrote:
> >
> > >Hello,
> >
> > >I have a dictionary and will get all keys which ha
In article
<[EMAIL PROTECTED]>,
Nader <[EMAIL PROTECTED]> wrote:
> On Jun 12, 1:41 pm, David C. Ullrich <[EMAIL PROTECTED]> wrote:
> > On Thu, 12 Jun 2008 03:58:53 -0700 (PDT), Nader <[EMAIL PROTECTED]>
> > wrote:
> >
> > >Hello,
> >
> > >I have a dictionary and will get all keys which have the
On Jun 12, 6:41 am, David C. Ullrich <[EMAIL PROTECTED]> wrote:
> On Thu, 12 Jun 2008 03:58:53 -0700 (PDT), Nader <[EMAIL PROTECTED]>
> wrote:
>
> >Hello,
>
> >I have a dictionary and will get all keys which have the same values.
>
>
> d = {'a' : 1, 'b' : 3, 'c' : 2,'d' : 3,'e' : 1,'f' : 4}
>
> dd
On Jun 12, 2:15 pm, Nader <[EMAIL PROTECTED]> wrote:
> On Jun 12, 2:05 pm, Chris <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Jun 12, 1:48 pm, Nader <[EMAIL PROTECTED]> wrote:
>
> > > On Jun 12, 1:35 pm, [EMAIL PROTECTED] wrote:
>
> > > > Nader:
>
> > > > > d = {('a' : 1), ('b' : 3), ('c' : 2),('d' : 3)
Nader <[EMAIL PROTECTED]> wrote:
> I have a dictionary and will get all keys which have the same values.
>
> d = {('a' : 1), ('b' : 3), ('c' : 2),('d' : 3),('e' : 1),('f' : 4)}
>
> I will something as :
>
> d.keys(where their values are the same)
>
> With this statement I can get two lists for
On Jun 12, 2:05 pm, Chris <[EMAIL PROTECTED]> wrote:
> On Jun 12, 1:48 pm, Nader <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Jun 12, 1:35 pm, [EMAIL PROTECTED] wrote:
>
> > > Nader:
>
> > > > d = {('a' : 1), ('b' : 3), ('c' : 2),('d' : 3),('e' : 1),('f' : 4)}
> > > > I will something as :
> > > > d.key
On Jun 12, 1:48 pm, Nader <[EMAIL PROTECTED]> wrote:
> On Jun 12, 1:35 pm, [EMAIL PROTECTED] wrote:
>
>
>
> > Nader:
>
> > > d = {('a' : 1), ('b' : 3), ('c' : 2),('d' : 3),('e' : 1),('f' : 4)}
> > > I will something as :
> > > d.keys(where their values are the same)
>
> > That's magic.
>
> > > With
On Jun 12, 1:41 pm, David C. Ullrich <[EMAIL PROTECTED]> wrote:
> On Thu, 12 Jun 2008 03:58:53 -0700 (PDT), Nader <[EMAIL PROTECTED]>
> wrote:
>
> >Hello,
>
> >I have a dictionary and will get all keys which have the same values.
>
> >d = {('a' : 1), ('b' : 3), ('c' : 2),('d' : 3),('e' : 1),('f' :
On Jun 12, 1:35 pm, [EMAIL PROTECTED] wrote:
> Nader:
>
> > d = {('a' : 1), ('b' : 3), ('c' : 2),('d' : 3),('e' : 1),('f' : 4)}
> > I will something as :
> > d.keys(where their values are the same)
>
> That's magic.
>
> > With this statement I can get two lists for this example:
> > l1= ['a','e']
>
On Thu, 12 Jun 2008 03:58:53 -0700 (PDT), Nader <[EMAIL PROTECTED]>
wrote:
>Hello,
>
>I have a dictionary and will get all keys which have the same values.
>
>d = {('a' : 1), ('b' : 3), ('c' : 2),('d' : 3),('e' : 1),('f' : 4)}
That's not a dictionary, it's a syntax error. If you actually
have a d
Nader:
> d = {('a' : 1), ('b' : 3), ('c' : 2),('d' : 3),('e' : 1),('f' : 4)}
> I will something as :
> d.keys(where their values are the same)
That's magic.
> With this statement I can get two lists for this example:
> l1= ['a','e']
> l2=['b','d']
> Would somebody tell me how I can do it?
You c
Hello,
I have a dictionary and will get all keys which have the same values.
d = {('a' : 1), ('b' : 3), ('c' : 2),('d' : 3),('e' : 1),('f' : 4)}
I will something as :
d.keys(where their values are the same)
With this statement I can get two lists for this example:
l1= ['a','e']
l2=['b','d']
W
14 matches
Mail list logo