In the above code the list is added at the end of my_list. To add only the elements of another list ( any iterable ) we can use extend(). This is the difference between append and extend methods.
Using len() function we can get the total number of elements in a list. So in a zero based index system ( first element position is 0 ) we can add the element at last position by using len().
Append adds the element at the end of the list ( always) , by using insert we can add element at any given position.
Adding at the end of the list
If we add element by using insert at the end of the list , then it is same as append.
my_list=['Alex','Ronald','John']
#my_list.append('new name') # adds at the end of the list
my_list.insert(len(my_list),'new name') # adds at the end of the list
print(my_list)
import json
path="D:\\my_data\\student.json" # use your sample file.
fob=open(path,)
data=json.load(fob)
names=[]
for student in data:
#print(student['name'])
names.append(student['name'])
print(names)
fob.close()