list、array、set、tuple转换方式:
其中np是
import numpy as np
list转array | a1 = np.array(l1) | array转list | l1 = a1.tolist() | |
list转set | s1 = set(l1) | set转list | l1 = list(s1) | |
list转tuple | t1 = tuple(l1) | tupel转list | l1 = list(t1) | |
array转set | s1 = set(a1) | set转array | a1 = np.array(s1) | |
array转tuple | t1 = tuple(a1) | tuple转array | a1 = np.array(t) | |
set转tuple | t1 = tuple(s1) | tuple转set | s1 = set(t1) |