Learn Enough Python to Be Dangerous: Software Development, Flask Web Apps, and Beginning Data Science with Python
by Michael Hartl
Chapter 3
Lists
In Chapter 2, we saw that strings can be thought of as sequences of characters in a particular order. In this chapter, we’ll learn about the list data type, which is the general Python container for a list of arbitrary elements in a particular order. Python lists are similar to the array data type in other languages (such as JavaScript and Ruby), so programmers familiar with other languages can probably guess a lot about how Python lists behave. (Although Python does have a built-in array type, in this tutorial “array” always refers to the ndarray data type defined by the NumPy library, which is covered in Section 11.2.)
We’ll start by explicitly connecting strings and lists via the split() method (Section 3.1), and then learn ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access