结束for循环后执行else

for i in range(5):
     print(i)
else:
    print("打印else")

 

python中for—else的用法,执行完for执行else

 

相关文章: