利用range() 控制循环

s = ['a','b','c','d','e']

for i in range(len(s)):
...     if i < len(s)-1:
...         print s[i]

a
b
c
d

for i in range(len(s)):
...     if i < len(s)-1:
...         print s[i+1]
...
b
c
d
e

for i in range(len(s)):
...     if i < len(s)-1:
...         print s[i], s[i+1]
...
a b
b c
c d
d e

by freemao

FAFU

free_mao@qq.coom

上一篇:ssm框架junit简单测试_我写


下一篇:ajax form表单提交 input file中的文件