09 2024 档案
用python写一个脚本:将指定目录下所有的srt文件中的,“周期”改成“cycles渲染器”,“电动汽车”改成“EV渲染器”,“自行车”改成“cycles渲染器”,“飞机”改成“平面”,并保存到新的srt文件中
摘要:代码: import os import re def replace_text_in_srt(file_path, replacements): with open(file_path, 'r', encoding='utf-8') as file: content = file.read() f
阅读全文
删除字幕中的韩文并保存到新的文件中
摘要:代码: import os import re def remove_korean_text(srt_content): # 定义韩文字符的Unicode范围 pattern = re.compile(r'[\uac00-\ud7a3]+', re.UNICODE) # 使用正则表达式替换韩文字符为
阅读全文
用python写一段代码:读取一张图片中的所有颜色信息,并按照占比大小,从大到小依次列出颜色的HEX值,并将列出的内容保存到txt文件中
摘要:from PIL import Image from collections import Counter import numpy as np def save_colors_to_file(image_path, output_file): # 打开图片文件 image = Image.open
阅读全文