a = [5, 66, 7, 8, 9, ...]
是否可以进行迭代而不是这样写?
Is it possible to make an iteration instead of writing like this?
a[1] - a[0]
a[2] - a[1]
a[3] - a[2]
a[4] - a[3]
...
谢谢!
当然.
for i in range(1, len(a)):
print a[i] - a[i-1]
我看不出真正的问题是什么.你读过python 教程吗?
I fail to see what the real problem is here. Have you read the python tutorial?
这篇关于列表或元组的成对遍历的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!