- 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":

推薦閱讀
- Developing Middleware in Java EE 8
- Amazon S3 Cookbook
- Oracle BAM 11gR1 Handbook
- Windows Forensics Cookbook
- Unity 5.x By Example
- 自然語言處理Python進(jìn)階
- HTML5從入門到精通 (第2版)
- Getting Started with Nano Server
- Practical Microservices
- .NET 4.0面向?qū)ο缶幊搪劊簯?yīng)用篇
- Get Your Hands Dirty on Clean Architecture
- Vue.js 3.x高效前端開發(fā)(視頻教學(xué)版)
- JavaScript語法簡明手冊
- Appcelerator Titanium Smartphone App Development Cookbook
- Java EE 程序設(shè)計(jì)