From the Documentation available:
array.append(x):
Append a new item with value x to the end of the array.
So the append
function is what you need as it adds your given input as the next element in your array, which is adding your list as another element rather than extending the existing list.
values = []
records = contains two records of different person
values.append([records.name, records.age , records.gender])
print values
OUTPUT:
[[some_name,age,gender] , [some_name,age,gender]]
array.extend(iterable):
Append items from iterable to the end of the array. If iterable is another array, it must have exactly the same type code; if not, TypeError will be raised. If iterable is not an array, it must be iterable and its elements must be the right type to be appended to the array.
Whereas extends
function treats your given input as an extension to the given list and adds it to the existing list only.
values = []
records = contains two records of different person
values.extend((records.name, records.age , records.gender))
print values
Output:
[some_name,age,gender , some_name,age,gender]