On 2014-04-08 23:55, Peter Otten wrote:
You can create and sort the list in a single step:
l = sorted(myDict)
Thank you again; this is a new idiom for me.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https:
Alex Kleider wrote:
> On 2014-04-08 14:34, Peter Otten wrote:
>
>> That's a change in Python 3 where dict.keys() no longer creates a list,
>> but
>> instead creates a view on the underlying dict data thus saving time and
>> space. In the rare case where you actually need a list you can
>> explici
On 2014-04-08 14:34, Peter Otten wrote:
That's a change in Python 3 where dict.keys() no longer creates a list,
but
instead creates a view on the underlying dict data thus saving time and
space. In the rare case where you actually need a list you can
explicitly
create one with
ips = list(ipD
Alex Kleider wrote:
> I've got a fairly large script that uses a dictionary (called 'ipDic')
> each
> value of which is a dictionary which in turn also has values which are
> not
> simple types.
> Instead of producing a simple list,
> """
> ips = ipDic.keys()
> print(ips)
> """
> yields
> """
> di
I've got a fairly large script that uses a dictionary (called 'ipDic')
each
value of which is a dictionary which in turn also has values which are
not
simple types.
Instead of producing a simple list,
"""
ips = ipDic.keys()
print(ips)
"""
yields
"""
dict_keys(['61.147.107.120', '76.191.204.54',