Fetch first 10 results from a list in Python

list[:10]

will give you the first 10 elements of this list using slicing.

However, note, it’s best not to use list as a variable identifier as it’s already used by Python: list()

To find out more about this type of operation, you might find this tutorial on lists helpful and this link: Understanding slicing

Leave a Comment