slice last 4 items from a list

brad byte8bits at gmail.com
Mon Oct 1 16:27:43 EDT 2007


Is this the correct way to slice the last 4 items from a list?

x = [1,2,3,4,5,6,7,8,9]
print x[-4:]

It works, but is it Pythonic?



More information about the Python-list mailing list