python take all but last element code example
Example 1: get every item but the last item of python list
x = [1, 2, 3, 4]
#same array, but the last item.
notLast = x[0:-1]
Example 2: python print last 3
message = iloveyouchina
#get last x words
#for example x = 3
print(message[-3:]