02 2024 档案
摘要:import os import re def remove_characters_from_file(file_path): with open(file_path, 'r', encoding='utf-8') as file: content = file.read() # 删除所有中英文括号
阅读全文
摘要:import os import tkinter as tk from tkinter import simpledialog, messagebox from PIL import Image, ImageTk class ImageViewer(tk.Tk): def __init__(self
阅读全文
摘要:import os import tkinter as tk from tkinter import simpledialog, messagebox from PIL import Image, ImageTk class ImageViewer(tk.Tk): def __init__(self
阅读全文
摘要:import os import shutil import pandas as pd def clean_filename(filename): """ 清理文件名中的特定符号,将它们替换为破折号(-)。 """ symbols = ['<', '>', ':', '"', '/', '\\',
阅读全文
摘要:instructions = { 1: "请根据输入的10条数据的语言执行相反的翻译,输入数据为 '{0}'(如果输入是英语,则翻译成中文;如果输入是中文,则翻译成英语)(换行符分隔),只返回翻译后的结果,不要包含原文,每条也用换行分隔。请确保翻译结果使用完整的自然语言句子,除逗号、句号外不要有特殊
阅读全文
摘要:from openai import OpenAI client = OpenAI( base_url="https://oneapi.xty.app/v1", api_key="sk-gfJsNLc7n7AWUmJG4c2030D10d1d479197400c6c53D58d79" ) # 定义系
阅读全文
摘要:import os import uuid from pathlib import Path # 定义一个函数来生成唯一的文件名 def generate_unique_filename(extension): return f"{uuid.uuid4()}{extension}" # 定义支持的图
阅读全文
摘要:import os import shutil def is_image_file(filename): """检查文件是否为图片文件。""" image_extensions = ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.tiff'] return a
阅读全文
摘要:import os import zipfile import re import shutil def extract_zip_in_folder(folder_path): # 检查路径是否存在 if not os.path.exists(folder_path): print("路径不存在,请
阅读全文