Home > Backend Development > Python Tutorial > Python Learning with Guibs_Tuples

Python Learning with Guibs_Tuples

黄舟
Release: 2017-01-20 16:21:33
Original
1519 people have browsed it

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)
Copy after login

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)!


Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template