1. Use the + operator

Such as:

    a = [1.2.3]

    b = [4.5.6] c = a+b1.2.3.4.5.6]
Copy the code

2. Extend

Such as:

   a = [1.2.3]

    b = [4.5.6A. xtend(b) A result: [1.2.3.4.5.6]
Copy the code





The result is the same, but the + generates a new object, while extend modifs the A object in place.

Append method

Note also that the append method of a list adds new elements to the list such as:

    a = [1.2.3]

    a.append(4) # is followed by the element typeThe result of a is: [1.2.3.4]
Copy the code

 

CSDN official learning recommendation* * * *

CSDN provides a full stack knowledge graph for Python.