4.5元祖
Posted yuxinjack
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了4.5元祖相关的知识,希望对你有一定的参考价值。
4.5.1定义元祖
dimensions = (200, 5) print(dimensions[0]) print(dimensions[1])
200 5
4.5.2遍历元祖中的所有值
dimensions = (200, 5) for dimension in dimensions: print(dimension)
200 5
4.5.3修改元祖变量
dimensions = (200, 5) print("Original dimensions:") for dimension in dimensions: print(dimension) dimensions = (400, 100) print(" Modified dimensions:") for dimension in dimensions: print(dimension)
Original dimensions: 200 5 Modified dimensions: 400 100
以上是关于4.5元祖的主要内容,如果未能解决你的问题,请参考以下文章