Python: Append A List at the Start of Another List

If you want to append a list at the start (beginning) of another list in Python then you can do that in many ways, let's take a look at a few.



Example 1: Using extend() function

    nos_list_1 = [2, 4, 0]
    nos_list_2 = [-1, -2, -7] # append this list to list_1
    
    nos_list_2.extend(nos_list_1)
    print(nos_list_2)
    Output:
    [-1, -2, -7, 2, 4, 0]


Example 2: Using + Operator

    nos_list_1 = [2, 4, 0]
    nos_list_2 = [-1, -2, -7]
    
    appended_list = nos_list_2 + nos_list_1
    print(appended_list)
    Output:
    [-1, -2, -7, 2, 4, 0]

Example 3: Using Unpacking

    nos_list_1 = [2, 4, 0]
    nos_list_2 = [-1, -2, -7]
    
    appended_list = [*nos_list_2, *nos_list_1]
    print(appended_list)
Examples - Appending List at the start of another list

Comments & Discussion

Facing issues? Have questions? Post them here! We're happy to help!