key_and_item = dict([(x,0) for x in range(10)]) {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0}
key_only = list(key_and_item) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] # OrderedDict will also have the same effect
No comments :
Post a Comment