Open raku-26 opened 6 months ago
import csv
def remove_first_line(input_filename, output_filename): with open(input_filename, mode='r', newline='') as file: reader = csv.reader(file) next(reader) # 跳过第一行(标题行)
with open(output_filename, mode='w', newline='') as outfile:
writer = csv.writer(outfile)
# 写入剩余行
for row in reader:
writer.writerow(row)
input_filename = 'input.csv' output_filename = 'output.csv' remove_first_line(input_filename, output_filename)
import os
def rename_files(directory):
遍历指定目录中的所有文件
调用函数,输入你的文件夹路径
directory_path = "your_directory_path_here" rename_files(directory_path)