Python: Fetch first 10 results from a list -


this question has answer here:

is there way can fetch first 10 results list. maybe:

list = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]  list.fetch(10) 

?

list[:10] 

will give first 10 elements of list using slicing.

however, note, it's best not use list variable identifier it's used python: list()

to find out more these type of operations might find tutorial on lists helpful , link @darenthomas provided explain python's slice notation - daren)


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -