# -*- coding: utf-8 -*- import numpy as np import pandas as pd import re from re import sub import smtplib import matplotlib.pyplot as plt from itertools import product from tqdm import tqdm_notebook, tqdm, trange import time import warnings from datetime import datetime import csv def save_database_info(filepath, database_name, date): # 读取CSV文件 # with open(f'./database_name.csv', 'r', encoding='utf-8') as file: with open(filepath, 'r', encoding='utf-8') as file: # 创建CSV读取器 reader = csv.reader(file) # 将内容存储到列表中 rows = [] for row in reader: rows.append(row) # 添加新行 # new_row = ['New Data 1', 'New Data 2'] # 新行的数据 new_row = [database_name, date] # 新行的数据 rows.append(new_row) # 写入CSV文件 # with open('./database_name.csv', 'w', newline='', encoding='utf-8') as file: with open(filepath, 'w', newline='', encoding='utf-8') as file: # 创建CSV写入器 writer = csv.writer(file) # 写入所有行 writer.writerows(rows) # close the file to save the data. file.close() return None