在Python中,不用while和for循环遍历列表的实例
时间:2021-08-15 09:34:41|栏目:Python代码|点击: 次
如下所示:
a = [1, 2, 3, 8, 9]
def printlist(l, index):
if index == len(l):
return
else:
print(l[index])
printlist(l, index + 1)
printlist(a, 0)
*****for和while循环底层用的是递归实现的
上一篇:python实现哈希表
栏 目:Python代码
本文标题:在Python中,不用while和for循环遍历列表的实例
本文地址:http://www.codeinn.net/misctech/167099.html






