“Python/gloss python tuple length”的版本间差异

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

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

<languages />

Python元组长度

元组长度

要确定元组有多少项,请使用 len() 方法:

打印元组中的项目数:

thistuple = ("apple", "banana", "cherry")

  print(len(thistuple))