tolist()作用於矩陣



若有幫助到你,記得點贊哦!

# -*- coding: utf-8 -*-
"""
Created on Sun Mar 25 09:58:19 2018

@author: Lelouch_C.C
"""

from numpy import *

a= mat([[1,2,3],
 [4,5,6],
 [7,8,9]])
c=a.tolist()
print(c)

"""
輸出:
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]  #可以看出,tolist()將矩陣a轉換爲一個以列表爲元素的列表
"""

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章