get all first elements of list of listspython code example
Example 1: python get first n elements of list
l = [1, 2, 3, 4, 5]
print(l[:3])
Example 2: how to find first element in a list python
an_array = [1,2,3,4,5]
first element = an_array[0]
l = [1, 2, 3, 4, 5]
print(l[:3])
an_array = [1,2,3,4,5]
first element = an_array[0]