摘要:
列表循环式:[x * x for x in range(1, 11)] 生成器:(x * x for x in range(1, 11))后者返回一个对象: >>> L = [x*x for x in range(10)] >>> L [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] >>> g = (x*x for x in range(10)) >>> g at... 阅读全文
摘要:
https://blog.csdn.net/jiangjiang_jian/article/details/79453856 [s[i:i + x + 1] for x in range(len(s)) for i in range(len(s) - x)] [s[i:i + x + 1] for 阅读全文