我试图附加到2D列表中的特定索引

时间:2017-01-25 21:32:10

标签: python-3.x

a=1+2 
import csv
    all_items=[]
    with open('stockes.csv') as product:
        stockes=csv.reader(product)
        for row in stockes:
            all_items.append(row)
    print(all_items[1][2])
    all_items([1],[2]).append(a)
抱歉,但是a代替了我的正常变量,这也是我的第一个问题

1 个答案:

答案 0 :(得分:0)

列表是 [['条形码','名称','股票','奖品'],[' 13245627', '普通括号',' 3',' 599'],[' 12345670',' 100 mm螺栓', ' 7',' 550'],[' 56756777',' L形括号',' 8', ' 230']]

a=1+2 
import csv
    all_items=[]
    with open('stockes.csv') as product:
        stockes=csv.reader(product)
        for row in stockes:
            all_items.append(row)
    print(all_items[1][2])
    all_items([1][2]).append(a)
抱歉,我希望这更好