Python: Initialize a list of lists to a certain size,

后端 未结 2 1637
梦如初夏
梦如初夏 2021-01-25 11:53

I\'m trying to initialize \'big_list\', which is a list containing lists, and we know in advance that there will be 200 lists within \'big_list\', and that each list will contai

2条回答
  •  既然无缘
    2021-01-25 12:17

    You can use list comprehension for example:

    big_list = [[] for _ in range(200)]
    

    That will create a list containing 200 different lists.

提交回复
热议问题