python如何用csv包读取和写入csv 发表于 2022-11-01 分类于 鼓捣电脑 本文字数: 305 阅读时长 ≈ 1 分钟 读取12345678import csvfile_path = '1908194624.csv'with open(file_path,encoding="utf_8") as f: reader = csv.reader(f) header_row = next(reader) #略过标题行 for row in reader: #遍历每一行 weibo_id = row[1] 写入123with open('result_file.csv','w') as csvfile: writer = csv.writer(csvfile) writer.writerow(header)