- Hands-On Penetration Testing with Python
- Furqan Khan
- 132字
- 2021-07-02 14:13:50
Merging and updating lists
List merging can be done in two ways in Python. First, we can use the traditional + operator, which we used previously to concatenate two strings. It does the same when used on list object types. The other way to achieve this would be by using the extend method, which takes the new list as an argument to be merged with the existing list. This is shown in the following example:

To update an element in the list, we can access its index and add the updated value for any element that we wish to update. For example, if we want to have the string Hello as the 0th element of the list, this can be achieved by assigning the 0th element to the Hello value as merged[0]="hello":

推薦閱讀
- 解構產品經理:互聯網產品策劃入門寶典
- Python機器學習:數據分析與評分卡建模(微課版)
- MATLAB圖像處理超級學習手冊
- 動手玩轉Scratch3.0編程:人工智能科創教育指南
- Java深入解析:透析Java本質的36個話題
- Learn WebAssembly
- 老“碼”識途
- 快速念咒:MySQL入門指南與進階實戰
- 區塊鏈架構之美:從比特幣、以太坊、超級賬本看區塊鏈架構設計
- 大學計算機應用基礎(Windows 7+Office 2010)(IC3)
- HTML5移動前端開發基礎與實戰(微課版)
- VMware vSphere 5.5 Cookbook
- Spring Boot從入門到實戰
- 3D Printing Designs:Design an SD Card Holder
- Azure for Architects