官术网_书友最值得收藏!

List operations

In this section, we are going to learn about basic list operations: concatenation and repetition.

The + operator concatenates lists:

>>> a = [30, 50, 60]
>>> b = ['Hello', 75, 66 ]
>>> c = a + b
>>> print c
[30,50,60,'Hello',75,66]

Similarly, the * operator repeats a list a given number of times:

>>> [0] * 4
[0, 0, 0, 0]
>>> ['Python'] * 3
['python', 'python', 'python']
主站蜘蛛池模板: 南京市| 万山特区| 沭阳县| 吕梁市| 奉化市| 泉州市| 镇平县| 临高县| 搜索| 宁蒗| 易门县| 岗巴县| 溆浦县| 内黄县| 淅川县| 陵川县| 开远市| 浦北县| 信丰县| 洪江市| 梨树县| 北宁市| 日土县| 马尔康县| 南召县| 普定县| 新密市| 津南区| 望城县| 策勒县| 武宁县| 明星| 揭西县| 壶关县| 奉贤区| 鄱阳县| 探索| 庆安县| 上饶县| 宜章县| 新野县|