Generation

generate functionThu, 20 Apr 2023

insert an image into a column of csv file.

def image_to_csv(image_path, csv_path, col_num): with open(csv_path) as f: reader = csv.reader(f) # read CSV into list data = list(reader) # insert image file name into column data[0][col_num] = image_path # write CSV with open(csv_path, 'w') as f: writer = csv.writer(f) writer.writerows(data)

Want to kickstart your project?Use the new AI Studio to create your code