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

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']
主站蜘蛛池模板: 阳高县| 淮阳县| 句容市| 凉山| 逊克县| 铜陵市| 淳安县| 象山县| 廊坊市| 萨迦县| 临夏市| 大理市| 龙州县| 商河县| 永嘉县| 伊宁县| 淮阳县| 阳曲县| 宜君县| 辉南县| 綦江县| 杭州市| 恭城| 柳河县| 都昌县| 格尔木市| 永定县| 灵山县| 葵青区| 临武县| 葵青区| 济阳县| 安塞县| 清河县| 广昌县| 宜兴市| 佳木斯市| 象州县| 兴业县| 小金县| 双江|