回答編集履歴
1
Update
answer
CHANGED
@@ -4,12 +4,12 @@
|
|
4
4
|
def flatten_recursive(lst):
|
5
5
|
return (sum(map(flatten_recursive, lst), [])
|
6
6
|
if isinstance(lst, list) and isinstance(lst[0], list)
|
7
|
-
else [lst])
|
7
|
+
else [tuple(lst)])
|
8
8
|
|
9
9
|
if __name__ == '__main__':
|
10
10
|
lst = [[1, 2], [[[2, 1], [1, 3]], [4, 2]], [1, 3]]
|
11
11
|
flat_list = flatten_recursive(lst)
|
12
|
-
unique_flat_list = list(map(list, set(
|
12
|
+
unique_flat_list = list(map(list, set(flat_list)))
|
13
13
|
print(unique_flat_list)
|
14
14
|
|
15
15
|
_ = '''
|