Home>Article>Backend Development> The difference between python arrays and lists
The difference between python arrays and lists:
list does not have all the attributes of array (such as dimensions, transposition, etc.).
Code:(Recommended learning:Python video tutorial)
#eg1_1 import numpy as np a = np.array([[1,2,0,1],[1,6,9,55],[7,8,9,5]])#a为数组 print(a.T) #Result: [[ 1 1 7] [ 2 6 8] [ 0 9 9] [ 1 55 5]] #eg1_2 a = [[1,2,0,1],[1,6,9,55],[7,8,9,5]] #a为列表 print(a.T) #Result: 'list' object has no attribute 'T'
For more Python related technical articles, please visitLearn in the Python tutorialcolumn!
The above is the detailed content of The difference between python arrays and lists. For more information, please follow other related articles on the PHP Chinese website!