数据合并
类型:程序题

题目说明

如下图所示,学校食堂要将大米的入库和出库数据,合并到文件“合并.csv”中。其中入库数据文件为"入库.csv",出库数据文件为"出库.csv",文件"入库.csv"、文件"出库.csv"和“合并.csv”都放置在

程序所在的文件夹,请补全代码。

图

import csv
in1=[]
in2=[]
with open('入库.csv') as f1:
    rows = list(         ①        )
    for a in rows:
        in1.        ②        
with open('出库.csv') as f2:
    rows = list( csv.reader (f2))
    for a in rows:
        in2.        ③        
with open('合并.csv', 'w', encoding='utf_8_sig', newline='') as f3:
    writer = csv.writer(f3)
    for a in in1:
        writer.writerow(a)
    for a in in2:
        writer.        ④        

评分标准

(1)csv.reader (f1) 或等效答案;(4分)

(2)append(a) 或等效答案; (2分)

(3)append(a) 或等效答案; (2分)

(4)writerow(a) 或等效答案。(2分)

代码编辑器 加载中...
留空使用题目默认限制
{{resultStatus.text}}
正在加载运行记录...
乐编题库AI助手
人工客服
微信扫码联系客服
历史对话
{{ s.title || '未命名对话' }}
{{ s.created_at }}
暂无历史对话
我能帮助你什么?