The difference between the 1 and 22 segments is that print is in the For loop and the other is not in the loop. The results of the output are quite different, if you want to figure out how to traverse the two lists, take some time to figure out the following lines of code. What I'm going to say is very easy for you to look at.
1.
650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" border:none;margin:0px;padding:0px; "/>
# for loop two list of procedures list1 = [' 1 ', ' 1 ']list2 = [' A ', ' B ']for x in List1, List2:reslut = x[:] Print Reslut # type=list
650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" border:none;margin:0px;padding:0px; "/>
2.
650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" border:none;margin:0px;padding:0px; "/>
# for loop two list of procedures list1 = [' 1 ', ' 1 ']list2 = [' A ', ' B ']for x in List1, List2:reslut = x[:]print Reslut # type=list
650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" border:none;margin:0px;padding:0px; "/>
The results of the output were
1.
[' 1 ', ' 1 '] [' A ', ' B ']
2.
[' A ', ' B ']
Well, you see here, I will default you will not abandon my wordy. First of all, I am a novice to write a blog, really even a fluent can express my meaning, I have to ponder over and over again to write, let me write a space enough to stop the home of the Garden article. I really stretched out ah, but I am to open a blog is to exercise their words to express the ability, even if it is a bit of accumulation one day I will grow. Do not accumulate Kuibu not even thousands of miles!
It's a little far, but here 's how you can traverse two lists in a for loop in Python :
650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" border:none;margin:0px;padding:0px; "/>
#coding: Utf-8################## for Loop Two-list process list1 = [' 1 ', ' 1 ']list2 = [' A ', ' B '] for x in list1, list2: reslut = x[:] print reslut # type=listprint "---------" print list1, list2print "#############" # simple version dir = {' a ': ' a ', ' B ': ' B '} xq = dir.keys () yw = Dir.values () # This code is to iterate over two lists to assign to the new two list for i in xq, yw: answer, question = i[:] # Here you can add code to the element before assigning it to a new list print answer, ",", question # you can put this sentence out of the for loop and look at the result print "---------" # Complex version For j in xq: answer_ = j[:] print answer_, ",",  &NBsp; print "\ n" for k in yw: question_ = k[:] print question_, ",",
650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" border:none;margin:0px;padding:0px; "/>
The results of the operation are as follows:
650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" border:none;margin:0px;padding:0px; "/>
[' 1 ', ' 1 '] [' A ', ' B ']---------[' 1 ', ' 1 '] [' A ', ' B ']############ #A, Ba, b---------A, B, A, B,
650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" border:none;margin:0px;padding:0px; "/>
I post the code do not know what to say, I can only say more hands-on thinking, if you do not want to understand, do not give up, after two days to see. Maybe you'll be enlightened.
How Python iterates through two of lists in a for loop