python print array

Reference link: Array in Python | Array 2 (Introduction and Function)

a=[]

Create an array like [[0,0,0],[0,1,2]]

for i in range(3):

for j in range(4):

for k in range(5):

a1=[i,j,k]

a.append(a1)

Print out in 3 columns

for i in range(1,len(a)):

if i%3!=0:#If you want to print by a few columns, divide by a few

print(a[i-1],end="")

else:

print(a[i-1])

I saw another way to define an array

import array as arr

array_name   =   array_alias_name.array(type_code, elements)

arr1=arr.array("i",[1,2,3])

for i in range(3):

print(arr1[i])

You can use the Array.insert() and Array.append() methods in Python to add elements to the array.

Recommended Posts

python print array
python array add array_Python add array
print statement in python
Python Print print timer function
Python entry tutorial notes (3) array
Python implements multi-dimensional array sorting
Create Python two-dimensional array correctly
Python multithreading
Python CookBook
Python FAQ
Python3 dictionary
Python3 module
python (you-get)
Python string
Python descriptor
Python basics 2
Python notes
Python3 tuple
CentOS + Python3.6+
Python advanced (1)
Python decorator
Python IO
Python multithreading
Python toolchain
Python3 list
Python multitasking-coroutine
Python overview
python introduction
Python analytic
Python basics
07. Python3 functions
Python basics 3
Python multitasking-threads
Python functions
python sys.stdout
python operator
Python entry-3
Centos 7.5 python3.6
Python string
python queue Queue
Python basics 4
Python basics 5