Python List of Lists

  • Post category:List

A list can contain another list. This is called a nested list.

In this blog post, you will learn how to create a python list of lists.

Step 1: Create a list

my_list = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

Step 2: Print the list

print(my_list)

Output:

[[1, 2, 3], [4, 5, 6], [7, 8, 9]]