Everfighting
5/15/2017 - 3:51 PM

集合解析进行筛选

集合解析进行筛选

data = [2,-1,-3,6,8,2]
s = set(data)
# s= {2,-1,-3,6,8}
results = {x for x in s for x % 3 == 0}
# {-3,6}