摘要: import os import shutil import pandas as pd def clean_filename(filename): """ 清理文件名中的特定符号,将它们替换为破折号(-)。 """ symbols = ['<', '>', ':', '"', '/', '\\', 阅读全文
posted @ 2024-02-18 13:54 不上火星不改名 阅读(62) 评论(0) 推荐(0)
摘要: instructions = { 1: "请根据输入的10条数据的语言执行相反的翻译,输入数据为 '{0}'(如果输入是英语,则翻译成中文;如果输入是中文,则翻译成英语)(换行符分隔),只返回翻译后的结果,不要包含原文,每条也用换行分隔。请确保翻译结果使用完整的自然语言句子,除逗号、句号外不要有特殊 阅读全文
posted @ 2024-02-14 22:40 不上火星不改名 阅读(7) 评论(0) 推荐(0)
摘要: from openai import OpenAI client = OpenAI( base_url="https://oneapi.xty.app/v1", api_key="sk-gfJsNLc7n7AWUmJG4c2030D10d1d479197400c6c53D58d79" ) # 定义系 阅读全文
posted @ 2024-02-12 17:19 不上火星不改名 阅读(98) 评论(0) 推荐(0)
摘要: import os import uuid from pathlib import Path # 定义一个函数来生成唯一的文件名 def generate_unique_filename(extension): return f"{uuid.uuid4()}{extension}" # 定义支持的图 阅读全文
posted @ 2024-02-04 20:20 不上火星不改名 阅读(8) 评论(0) 推荐(0)
摘要: import os import shutil def is_image_file(filename): """检查文件是否为图片文件。""" image_extensions = ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.tiff'] return a 阅读全文
posted @ 2024-02-04 20:19 不上火星不改名 阅读(35) 评论(0) 推荐(0)
摘要: import os import zipfile import re import shutil def extract_zip_in_folder(folder_path): # 检查路径是否存在 if not os.path.exists(folder_path): print("路径不存在,请 阅读全文
posted @ 2024-02-01 11:28 不上火星不改名 阅读(21) 评论(0) 推荐(0)
摘要: import os import openpyxl from openpyxl.utils.exceptions import InvalidFileException def rename_images(base_dir, excel_path): # 检查基础路径是否存在 if not os.p 阅读全文
posted @ 2024-01-31 19:37 不上火星不改名 阅读(47) 评论(0) 推荐(0)
摘要: import os import shutil def delete_subfolders(directory): # 检查目录是否存在 if not os.path.exists(directory): print("指定的目录不存在:", directory) return # 遍历目录中的所有 阅读全文
posted @ 2024-01-30 21:58 不上火星不改名 阅读(29) 评论(0) 推荐(0)
摘要: import os from PIL import Image import tqdm def delete_images_with_height_greater_than_width(folder_path): # 遍历文件夹 for root, dirs, files in os.walk(fo 阅读全文
posted @ 2024-01-25 18:36 不上火星不改名 阅读(36) 评论(0) 推荐(0)
摘要: from openai import OpenAI client = OpenAI( base_url="https://oneapi.xty.app/v1", api_key="sk-gfJsNLc7n7AWUmJG4c2030D10d1d479197400c6c53D58d79" ) # 定义系 阅读全文
posted @ 2024-01-21 16:34 不上火星不改名 阅读(585) 评论(0) 推荐(0)