- 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']
推薦閱讀
- ServiceNow Application Development
- 編程卓越之道(卷3):軟件工程化
- TypeScript圖形渲染實(shí)戰(zhàn):基于WebGL的3D架構(gòu)與實(shí)現(xiàn)
- 網(wǎng)店設(shè)計(jì)看這本就夠了
- CouchDB and PHP Web Development Beginner’s Guide
- Python編程實(shí)戰(zhàn)
- 零基礎(chǔ)學(xué)Kotlin之Android項(xiàng)目開發(fā)實(shí)戰(zhàn)
- Kivy Cookbook
- SciPy Recipes
- Java Web從入門到精通(第2版)
- 零基礎(chǔ)學(xué)C語言(第4版)
- Hands-On Robotics Programming with C++
- 游戲設(shè)計(jì)的底層邏輯
- Visual FoxPro程序設(shè)計(jì)實(shí)驗(yàn)教程
- Visual Basic程序設(shè)計(jì)