- Mastering Python Scripting for System Administrators
- Ganesh Sanjiv Naik
- 72字
- 2021-07-02 14:00:23
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']
推薦閱讀
- Unity 2020 By Example
- Node.js+Webpack開發實戰
- Mastering Entity Framework Core 2.0
- 國際大學生程序設計競賽中山大學內部選拔真題解(二)
- 案例式C語言程序設計
- Python自動化運維快速入門
- Python Game Programming By Example
- Mastering Julia
- Bootstrap Essentials
- Cassandra Data Modeling and Analysis
- Microsoft System Center Orchestrator 2012 R2 Essentials
- Redis Essentials
- 單片機應用與調試項目教程(C語言版)
- Python算法詳解
- 微服務從小白到專家:Spring Cloud和Kubernetes實戰