01 2015 档案
摘要:6、collections 模块还提供有OrderedDict,用于获取有序字典import collectionsd = {'b':3, 'a':1,'x':4 ,'z':2}dd = collections.OrderedDict(d)for key, value in dd.items(): ...
阅读全文
摘要:1、如果想得到一个列表的index和内容,可以通过enumerate快速实现drinks = ['coffee','tea', 'milk', 'water']for index, drink in enumerate(drinks): print ('Item {} is {}'.forma...
阅读全文

浙公网安备 33010602011771号