[Tutor] Is there a programmatic use for keys() and values()

Steven D'Aprano steve at pearwood.info
Sun Jun 16 07:58:23 CEST 2013


On 16/06/13 11:53, Dave Angel wrote:
> On 06/15/2013 08:36 PM, Steven D'Aprano wrote:

>> for key in sorted(mydict.keys()):
>>      ...
>>
>> works fine.
[...]
> The sort() method doesn't work, but sorted does.
[...]
> for key in sorted(mydict.keys()):

Not only that, but sorted works too:

for key in sorted(mydict.keys())


*wink*


-- 
Steven


More information about the Tutor mailing list