On Tue, 01 May 2007 08:14:53 -0500, Hamilton, William wrote:
>> -Original Message-
>> From: Steven D'Aprano
>> Sent: Monday, April 30, 2007 10:14 PM
>> To: python-list@python.org
>> Subject: RE: Dict Copy & Compare
>>
>> On Mon, 3
> -Original Message-
> From: Steven D'Aprano
> Sent: Monday, April 30, 2007 10:14 PM
> To: python-list@python.org
> Subject: RE: Dict Copy & Compare
>
> On Mon, 30 Apr 2007 12:50:58 -0500, Hamilton, William wrote:
>
> >> On quick question, h
On Mon, 30 Apr 2007 12:50:58 -0500, Hamilton, William wrote:
>> On quick question, how can I order a dict by the 'values' (not keys)
>> before
>> looping? Is that possible?
>>
>
> The easiest way I can think of is to create a new dict that's reversed.
>
> reverseDict = {}
> for key in dict1:
>
> -Original Message-
> From: [EMAIL PROTECTED]
[mailto:python-
> [EMAIL PROTECTED] On Behalf Of Robert
Rawlins -
> Think Blue
> Sent: Monday, April 30, 2007 6:09 AM
> To: 'Tim Golden'
> Cc: python-list@python.org
> Subject: RE: Dict Copy & Compare
>
1 over and done with :-D
Thanks,
Rob
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
On Behalf Of Tim Golden
Sent: 30 April 2007 12:54
Cc: python-list@python.org
Subject: Re: Dict Copy & Compare
Robert Rawlins - Think Blue wrote:
> On[e] quick question, how ca
Robert Rawlins - Think Blue wrote:
> On[e] quick question, how can I order a dict by
> the 'values' (not keys) before looping? Is that possible?
Depends on what you want to do. You can loop on
the sorted values very easily:
d1 = dict (a=2, b=1)
for value in sorted (d1.values):
print value
om: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
On Behalf Of Tim Golden
Sent: 30 April 2007 11:27
Cc: python-list@python.org
Subject: Re: Dict Copy & Compare
Robert Rawlins - Think Blue wrote:
> Hello Tim,
>
> Sorry, that 'value' was a slip up on my part, we're just
Robert Rawlins - Think Blue wrote:
> Hello Tim,
>
> Sorry, that 'value' was a slip up on my part, we're just dealing with keys
> here.
>
> I get that a dict stores unique keys only but we're comparing the two dicts,
> so when I say 'unique keys in dict 1' I basically mean all those keys that
> ar
On Mon, 30 Apr 2007 10:05:40 +0100, Robert Rawlins - Think Blue wrote:
> I have two dicts, one named 'this' and the other named 'that'.
>
> I want to get all the unique keys from 'this' and log them into a file, I
> then want to take all the unique values from 'that' and log them into a
> separat
ssage-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
On Behalf Of Tim Golden
Sent: 30 April 2007 10:15
Cc: python-list@python.org
Subject: Re: Dict Copy & Compare
Robert Rawlins - Think Blue wrote:
> I have two dicts, one named 'this' and the other named 'that'.
&
On Mon, 30 Apr 2007 09:40:53 +0100, Tim Golden wrote:
> Robert Rawlins - Think Blue wrote:
>> I'm looking for a little advice on dicts, firstly I need to learn how to
>> copy a dict, I suppose I could just something like.
>
>> Self.newdict = self.olddict
>
>> But I fear that this only creates a
Robert Rawlins - Think Blue wrote:
> I have two dicts, one named 'this' and the other named 'that'.
>
> I want to get all the unique keys from 'this' and log them into a file, I
> then want to take all the unique values from 'that' and log them into a
> separate file.
Couple of points which are c
7;s just a case of firstly returning a list of all keys that are in
'this' but NOT in 'that' and then visa versa, then loop over them performing
the function.
Rob
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
On Behalf Of Tim Golden
Sent: 30 A
Robert Rawlins - Think Blue wrote:
> I'm looking for a little advice on dicts, firstly I need to learn how to
> copy a dict, I suppose I could just something like.
> Self.newdict = self.olddict
> But I fear that this only creates a reference rather than an actual copy,
> this means that as soon a
14 matches
Mail list logo