python里list、array、set、tuple转换
原创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)
版权声明
所有资源都来源于爬虫采集,如有侵权请联系我们,我们将立即删除