Python: Creating An Empty List of Lists (Multidimensional, Matrix) in Python

Python does not have a direct way of creating a list of lists.  New developers may run into problems wherein each sublist in a list actually resolves to the same sublist.  The most direct way to create a list of lists is:

table = [ [ None for c in range(columns) ] for r in range(rows) ]

About the Author