
本文共 2742 字,大约阅读时间需要 9 分钟。
������ & ���������������������
���������������������
������������ Python ���������������������������������������������������������������������������������������������������������������������������������������
������������
��������������� ������������������������
my_tuple = ()
��������������� ������������������������������������������������
my_tuple = (1, 2, 3, 4, 5)
������������������������������������������������������������������������������������������������������������
my_tuple = 10, 20, 30, 40
���������������
my_tuple[3] = 10 # TypeError: 'tuple' object does not support item assignment
- ���������������������������������������������������������������������������������������
- ���������������������������������������������������������������������������������������
- ���������������������������������������������������������������������������������������
- ���������������������������������������
- ���������������������������������������������������������������
==
���������������������������������������������������is
���������������������������������������������������������������������������������������- ������
==
��������������������������������� - ������
is
��������������������������������������������� - ���������������������������������������������������������������������������
- ���������������������������������������������������������������������������
==
���is
���������������������������������������������������������������������
���������������������
���������������������
������������������������������������������������������������������������������
������������
���������
my_tuple = (10, 20, 30, 40)a, b, c, d = my_tupleprint(a) # 10print(b) # 20
���������������������������������������������������������������
������������
���������������������������������������������������������(*)������������������������
my_tuple = (1, 2, 3, 4, 5, 6, 7)a, *b, c = my_tupleprint(a) # 1print(b) # [2, 3, 4, 5, 6, 7]
���������
������������������
���������������������������������������������������������
a = [1, 2, 3]a[0] = 10print(a) # [10, 2, 3]
���������������������������������������������������������������������������������������������������
������������
���������
a = [1, 2, 3]b = aa = [4, 5, 6]print(b) # [1, 2, 3]
������������������������������������������������������������������������������
������ == ��� is ���������
��� Python ������==
��� is
������������������������
���������
a = [1, 2, 3]b = [1, 2, 3]print(a == b) # True���������������print(a is b) # False������������������������
���������������
������������
������������������������������������������������������������������������������������������
发表评论
最新留言
关于作者
