python中的一些格式

#一般循环格式:
while  <test1>:
      <statements1>
      if <test2> : break            #Exit loop now,skip else
      if <test3> : continue        #Go to top of loop now,to test1
      else :
           <statements2>               #Run if we didn't hit a 'break'

#for循环格式:
for <target> in <object> :
       <statements>
else :
       <statements>

Leave a Reply

Your email address will not be published. Required fields are marked *