“Python hängt an 2D -Array an” Code-Antworten

Python hängt an 2D -Array an

temp_list = [[], [], [], []]
temp_list[0].append("a1")
temp_list[1].append("a2")
temp_list[2].append("a3")
temp_list[3].append("a4")
Kodi4444

Python addieren Sie eine mehrdimensionale Liste

a_2d_list = [[1, 2], [3, 4]]
a_2d_list.append([5, 6])
Learned This Today

Python Append Row an 2D -Array angehängt

new_row.append([])
Kodi4444

Python 2D -Array Append

arr = []
arr.append([])
arr[0].append('aa1')
arr[0].append('aa2')
Ninja Hatori Cat Codr

Python hängt an 2D -Array an

"""0 shows no error , 1 shows error"""
error_list=[]   #main error list
p=0  #p - phone field
e=1  #e - mail field
d=1  #d - date field
temp_error=[]  #temporary error list created and to collect data everytime
if(p==1):
    temp_error.append('invalid number')
if(e==1):
    temp_error.append('invalid email')
if(d==1):
    temp_error.append('invalid admit date')
error_list.append(temp_error) 

#second call (you can call it recursively too by calling function name)
p=1  #p - phone field
e=0  #e - mail field
d=1  #d - date field
temp_error=[]
if(p==1):
    temp_error.append('invalid number')
if(e==1):
    temp_error.append('invalid email')
if(d==1):
    temp_error.append('invalid admit date')
error_list.append(temp_error)
print(error_list)

#OUTPUT : [['invalid email','invalid admit date'],['invalid number','invalid admit date']]
AMAN OJHA

2d Arrary.push in Python

for i in range(x):
         for j in range(y):
             z[i][j]=input()
Bored Bee

Ähnliche Antworten wie “Python hängt an 2D -Array an”

Fragen ähnlich wie “Python hängt an 2D -Array an”

Weitere verwandte Antworten zu “Python hängt an 2D -Array an” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen