Re: dict turn to list at runtime unexpected!!!

2014-12-04 Thread telnetgmike
On Friday, December 5, 2014 2:56:50 PM UTC+8, telne...@gmail.com wrote: > Why the following code gives me errors??? And why the print statement run 2 > times? I'll be appreciated your helps, thanks, > addrnum_dict = {'a':1,'b':2} > def orderaddrtimes(): > global addrnum_dict > print type(a

Re: dict turn to list unexpected at runtime???

2014-12-04 Thread telnetgmike
On Friday, December 5, 2014 3:20:14 PM UTC+8, Cameron Simpson wrote: > On 05Dec2014 15:01, telnetgm...@gmail.com wrote: > >Why the following code gives me errors??? And why the print statement run 2 > >times? I'll be appreciated your helps, thanks, > >addrnum_dict = {'a':1,'b':2} > >def orderaddr

dict turn to list at runtime unexpected!!!

2014-12-04 Thread telnetgmike
Why the following code gives me errors??? And why the print statement run 2 times? I'll be appreciated your helps, thanks, addrnum_dict = {'a':1,'b':2} def orderaddrtimes(): global addrnum_dict print type(addrnum_dict) addrnum_dict = sorted(addrnum_dict.iteritems(), key=lambda d:d[1],