“Python/gloss python loop list items”的版本间差异

来自菜鸟教程
跳转至:导航、​搜索
(Pywikibot 4.4.0.dev0)
 
(机器人:添加分类Python基础教程
 
第46行: 第46行:
 
</div>
 
</div>
 
<br />
 
<br />
 +
 +
[[分类:Python基础教程]]

2020年10月29日 (四) 08:48的最新版本

<languages />

Python Python遍历列表项

遍历列表项

您可以使用 for 环:

一张一张地打印列表中的所有项目:

thislist = ["apple", "banana", "cherry"]

  for x in thislist:
  print(x)