Home > Backend Development > Python Tutorial > The difference between python arrays and lists

The difference between python arrays and lists

(*-*)浩
Release: 2019-08-10 15:36:53
Original
7564 people have browsed it

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'
Copy after login

For more Python related technical articles, please visit Learn in the Python tutorial column!

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template