遍历字母:
>>> li = [chr(i) for i in range(ord("A"),ord("Z")+1)] >>> li ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
遍历数字:
>>> [i for i in range(1,10)] [1, 2, 3, 4, 5, 6, 7, 8, 9]2019-7-5 14:55:52
评论区