需要的分辨率,参数1必须有一个“写入”#39;方法。把字典变成csv

时间:2017-12-07 11:16:33

标签: python csv

我似乎无法让我的代码正常运行它不断给我相同的论据1必须有一个'写'方法

import csv
tank1 = [{'tank':1, 'product':['condenstate'], 'temp':12,'ullage':21000, 'level':70000}]
tank2 = [{'tank':2, 'product':['condenstate'], 'temp':12,'ullage':21000, 'level':70000}]
key1 = tank1,tank2[0].keys()
with open('motherwell.csv','w',newline='') as output_file:
    writer = csv.writer 

    writer = csv.writer(output_file, key1)
    writer = csv.writer(key1)

1 个答案:

答案 0 :(得分:0)

不确定您要实现的目标,但您可能只需要这样:

export class Auth {
    public access_token: string;
    public userName: string;

}

注意:这适用于Python 3,对于Python 2,您需要将文件打开为二进制文件(with open('motherwell.csv','w', newline='') as output_file: writer = csv.writer(output_file) writer.writerow(tank1) writer.writerow(tank2) )。