Created
October 19, 2012 02:57
-
-
Save unionx/3915983 to your computer and use it in GitHub Desktop.
我终于知道tuple这个数据类型有什么用了
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
#!/usr/bin/env python | |
list_in_list = [[1,2,3], [2,2,2], [1,2,3]] | |
try: | |
dist_list = list(set(list_in_list)) | |
except TypeError: | |
print("list in list") | |
tuple_in_list = [(1,2,3), (2,2,2), (1,2,3)] | |
dist_list = list(set(tuple_in_list)) | |
# dist_list is [(2,2,2), (1,2,3)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment