Recently wrote a little Python code, as a Java programmer, in the face of Python so convenient language can't help but a little excited. But sometimes there are things that you can't understand.
For example:
ER = [[], [4,5,6], [7,8,9]] Print(er)#here is a strange and strange error, if print (ER) This statement preceded by a space, #will be error "unexpected indent", if you remove the space to run successfully #not yet aware of Python's operating mechanismcols = [Row[1] forRowinchER]#explain the meaning of "row[1] for row in ER" #Row[1] for line 1th should be a row in this array of ERPrint(cols) cols= [row[1]+1 forRowinchER]Print(cols) num1= 10cols= [Row[1]-num1 forRowinchER]Print(cols) cols= [row[1]+1 forRowinchErifrow[1]%2==0]Print(cols) cols= [Er[i][i] forIinch[0,1,2]]Print(cols)
Really don't understand it! You can only remember it here first.
Python Learning II