Home  >  Article  >  Backend Development  >  Python Learning with Guibs_Tuples

Python Learning with Guibs_Tuples

黄舟
黄舟Original
2017-01-20 16:21:331500browse

Guibs’ Python Learning_Tuple

# 元组# 元组相当于不可变的列表, 使用圆括号 ()dimensions = (200, 50)
print(dimensions[0])
print(dimensions[1])# 遍历元组中的所有值for dimension in dimensions:
    print(dimension)# 修改元组变量
# 虽然不能修改元组元素, 但可以给存储元组的变量赋值. 因此, 如果要修改某个元组, 可以重新定义整个元组print(dimensions)
dimensions = (400, 100)
print(dimensions)

The above is the content of Guibs’ Python Learning_Tuple. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn