python中list,array,mat,tuple大小及類型
知識
11-04
#coding: utf-8
from numpy import *
a=[1,2,3,4,5,6,7]
b=array([[1,2,3],[4,5,6]])
c=mat([[1,2,3],[4,5,6],[7,8,9]])
d=(0,2,4,5,6)
print("a:{}
type:{},shape:{}".format(a,type(a),shape(a)))
print("b:{}{}type:{},shape:{}".format(b,"
",type(b),shape(b)))
print("c:{}
type:{},shape:{}".format(c,type(c),shape(c)))
print("d:{}
type:{},shape:{}".format(d,type(d),shape(d)))
#結果如下
a:[1, 2, 3, 4, 5, 6, 7]
type:<class "list">,shape:(7,)
b:[[1 2 3]
[4 5 6]]
type:<class "numpy.ndarray">,shape:(2, 3)
c:[[1 2 3]
[4 5 6]
[7 8 9]]
type:<class "numpy.matrixlib.defmatrix.matrix">,shape:(3, 3)
d:(0, 2, 4, 5, 6)
type:<class "tuple">,shape:(5,)
打開今日頭條,查看更多精彩圖片※LINUX用戶管理和用戶組管理基礎
※對vc++類和對象的逆向研究
TAG:程序員小新人學習 |