Python列表推导式 a = [i for i in range(100)if not(i % 2) and i % 3]解析
对于列表推导式:a=[iforiinrange(100)ifnot(i%2)andi%3]结果为a=[2,4,8,10,14,16,20,22,26,28,32,34,38,40,44,46,50,52,56,58,62,64,68,70,74,76,80,82,86,88,92,94,98]是因为Python中的真假测试对于整数而言,0为假,非0为真。对于(ifnot(i%2)and(i%3))