Q:Pythonic way to create list of lists

Tino Wildenhain tino at wildenhain.de
Sun Apr 12 13:39:42 CEST 2009


grkuntzmd at gmail.com wrote:
> I am just learning Python.
> 
> I am trying to create a list of empty lists: [[], [], [], ...] (10
> items total).

Apart from the solutions shown, why would you do that in the first
place?

Creating such a structure is probably not so pythonic so the way to
create it does not matter.

Sparse datastructures might be better represented with dicts.

Regards
Tino



More information about the Python-list mailing list