ls = [16, 81, 23, 74, 91, 612, 33, 812]
ls[2:6:3] #Starting from index 2 till index 5 and skip the next 2 indices
ls[::-1] # Reverse list is printed
只有第二行 iels[::-1]
被执行。我究竟做错了什么 ?
它确实执行所有行,默认情况下只输出最后一行。如果你想看到所有的步骤,你可以print
看到你想要看到的结果。
该答案还通过要求 jupyter 通过添加来系统地显示所有输出来提供替代方案
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句