如何刪除嵌套列表中的項目?在python中刪除嵌套列表中的項目撇號
c = [['1', '1', '10', '92'], ['262', '56', '238', '142'], ['86', '84', '149', '30'], ['48', '362', '205', '237'], ['8', '33', '96', '336'], ['39', '82', '89', '140'], ['170', '296', '223', '210'], ['16', '40', '65', '50'], ['16', '40', '65', '50']]
>>> [ ','.join(i[0:][0:]) for i in c]
['1,1,10,92', '262,56,238,142', '86,84,149,30', '48,362,205,237', '8,33,96,336', '39,82,89,140', '170,296,223,210', '16,40,65,50', '16,40,65,50']
不過,我會繼續括號
[[1,1,10,92], [262,56,238,142], [86,84,149,30], [48,362,205,237], [8,33,96,336'] [39,82,89,140], [170,296,223,210], [16,40,65,50], [16,40,65,50]]
我怎樣才能完成這個任務?
這些引號表示您的子列表的元素是* strings *。你需要把它們變成整數。 – roippi