xxxxxxxxxx
# list.insert(before, value)
list = ["a", "b"]
list.insert(0, "c")
print(list) # ['c', 'a', 'b']
Simply use the .insert() method with an index of 0
xxxxxxxxxx
# Python3 code to demonstrate
# to add element at beginning
# using insert()
# initializing list
test_list = [1, 3, 4, 5, 7]
# printing initial list
print ("Original list : " + str(test_list))
# using insert() to append
# at beginning. append 6
test_list.insert(0, 6)
# printing resultant list
print ("Resultant list is : " + str(test_list))