List是一个对象,它有一此内置的方法,如:
包含关系: in, not in
>>> a = [1, 3, 5, 7];
>>> 3 in a
True
>>> 8 in a
False
>>> 8 not in a
True
>>>
连接符: +
>>> a + [9, 11]
[1, 3, 5, 7, 9, 11]
重复: *
>>> a * 2
[1, 3, 5, 7, 1, 3, 5, 7]
>>>
时间: 2024-10-13 00:35:32
List是一个对象,它有一此内置的方法,如:
包含关系: in, not in
>>> a = [1, 3, 5, 7];
>>> 3 in a
True
>>> 8 in a
False
>>> 8 not in a
True
>>>
连接符: +
>>> a + [9, 11]
[1, 3, 5, 7, 9, 11]
重复: *
>>> a * 2
[1, 3, 5, 7, 1, 3, 5, 7]
>>>