python 键值排序输出

method1:

dic = {}

keys= dic.keys()

keys.sort()

for key in keys:

print dic[key]

 

method2:

for key in sorted(write_list_hash.keys()):
print write_list_hash[key]

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>