标签:div list demo color sel images ges app 转换
*. zip(), dict() def demo_zip_dict(): keys = [‘a‘, ‘b‘, ‘c‘] values = [1, 2, 3] entrys = zip(keys, values) print(entrys) dictionary = dict(entrys) print(dictionary) ---- [(‘a‘, 1), (‘b‘, 2), (‘c‘, 3)] {‘a‘: 1, ‘c‘: 3, ‘b‘: 2} *. itertools.repeat() def demo_iter_repeat(): repeat_versions = itertools.repeat("0.0.1") images = ("a", "b") dic = dict(zip(images, repeat_versions)) print(dic) print(list(dic)) ---- {‘a‘: ‘0.0.1‘, ‘b‘: ‘0.0.1‘} [‘a‘, ‘b‘] *. list作用于迭代器,将其转换为list。 list(self.__apps.items())
zip(), dict(), itertools.repeat(), list(迭代器)
标签:div list demo color sel images ges app 转换
原文地址:https://www.cnblogs.com/wenlin-gk/p/11055056.html