python一行代码创建并返回空列表

 

 

you can do this in one line by:

a = [0 for _ in range(10)]

 

参考: https://stackoverflow.com/questions/10712002/create-an-empty-list-in-python-with-certain-size

posted @ 2021-03-25 11:35  略略略——  阅读(193)  评论(0)    收藏  举报