When dealing with data structures it is often that we have to remove the last element from the list. There are many ways of doing it and I will explain, which one you should use and why others are not ideal even if they get the job done.
The right way to remove the last element from a list object
del record[-1]
This method will remove the last item in the list, this is the most efficient way of removing the last item in the Python list.
Other less right ways
record = record[:-1]
This method while getting the job done, clones the object without the last item every time you do this, now if you do it once and the list is short this is not a problem, but if you have a massive look and the list object contains millions of items this can become a problem.