Skip to content

Instantly share code, notes, and snippets.

@Everfighting
Created May 15, 2017 15:51
Show Gist options
  • Save Everfighting/720c748d189fb3bdfecc7489a98f8bfe to your computer and use it in GitHub Desktop.
Save Everfighting/720c748d189fb3bdfecc7489a98f8bfe to your computer and use it in GitHub Desktop.
集合解析进行筛选
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}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment