学习笔记25—python基本运算法则

1、矩阵的点乘: a*b, 矩阵乘法:dot(a*b),矩阵的次方:a**num (num = 2,表示2次)
2、数组的并集,交集:
>>> a = [1,2,3]
>>> b = [2,4,5]
>>> list(set(a).intersection(set(b)))
[2]
>>> list(set(a).union(set(b)))
[1, 2, 3, 4, 5]
>>> list(set(a).difference(set(b)))
[1, 3]
>>> list(set(b).difference(set(a)))
[4, 5]
原文:https://blog.csdn.net/longzhiwen888/article/details/46562303
3、集合的交集,合集和补集:

猜你喜欢

转载自www.cnblogs.com/hechangchun/p/9829293.html