Last active
February 18, 2020 03:04
-
-
Save stilllisisi/ba6e5e8bf3043c71c3903533f184d13d to your computer and use it in GitHub Desktop.
【python-列表/字典处理】使用sets计算交集和差集
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set1 = {1,2,3,4} | |
set2 = {3,4,5,6} | |
set1.intersection(set2)#交集 | |
set1.difference(set2)#差集 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment