Python comes with a collection of built-in data types that make common data-wrangling operations easy. Among them is the list, a simple but versatile collection type. With a Python list, you can group Python objects together in a one-dimensional row that allows objects to be accessed by position, added, removed, sorted, and subdivided.
Python list basics
Defining a list in Python is easy—just use the bracket syntax to indicate items in a list, like this:
list_of_ints = [1, 2, 3]
Items in a list do not have to all be the same type; they can be any Python object. In the list below, assume Three is a function:
To read this article in full, please click here
InfoWorld
Article Categories:
Uncategorized