Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 替换二维列表中的值_Python_Python 3.x - Fatal编程技术网

Python 替换二维列表中的值

Python 替换二维列表中的值,python,python-3.x,Python,Python 3.x,我试图替换二维列表中的所有值 例如,如果list=[[2,3,4],[3,5,6]] 我想替换所有的值,因此新列表是list=[['','','','','','']] 或者,在一行中: emptied = list(map(lambda x: list(map(lambda y: '', x)), items)) [[''表示子目录]表示子目录] 您可能不应该命名变量列表 emptied = list(map(lambda x: list(map(lambda y: '', x)), it

我试图替换二维列表中的所有值

例如,如果
list=[[2,3,4],[3,5,6]]

我想替换所有的值,因此新列表是
list=[['','','','','','']]

或者,在一行中:

emptied = list(map(lambda x: list(map(lambda y: '', x)), items))
[[''表示子目录]表示子目录]
您可能不应该命名变量
列表

emptied = list(map(lambda x: list(map(lambda y: '', x)), items))