python 做成Excel并设置打印区域
记录首次用python处理Excel表格的过程。
参考文章:https://www.jianshu.com/p/5e00dc2c9f4c
程序要做的事情:
1. copy 模板文件到 output 文件夹并重命名为客户指定的文件名
2. 从 DB 查询数据并将数据写入 Excel
3. 写数据的同时, 设置每个单元格的样式
4. 设置打印区域
# -*- encoding: utf-8 -*-import utils.util as util
from database import sns_db
from logger import init_log, sns_logger
import time
from config.config import log_level_args, env_args
import sys
import os
import shutil
from datetime import datetime
from openpyxl import load_workbook
from openpyxl.styles import Font, Color, PatternFill, Border, Side, Alignment
import win32com.clientsys.path.append('../')def run(client_cds, start_date, end_date):""":param client_cds::param start_date::param end_date::return:"""try:# connect dbsns_db.connect(client_cds)# get client infoclient_info = sns_db.get_clients_by_cds(in_clients)if len(client_info) < 1:sns_logger.error("No such client [%s] !!!" % in_clients)returnclient_name = client_info[0]['client_name']report_month = start_date[:7].replace("-", "")records = sns_db.get_report_data(client_cds, start_date, end_date)# 模板文件的路径template_to_client_path = os.getcwd() + '/report/template/template-to-client.xlsx'template_chartgtp_path = os.getcwd() + '/report/template/template_chartGTP.xlsm'# 获取当前日期并格式化为字符串(例如:'2023-10-23')today = datetime.now().strftime('%Y-%m-%d')# 新文件的路径(使用当前日期作为文件名的一部分)new_file_to_client_path = os.getcwd() + f'/report/output/【{client_name}】月次レポート{report_month}.xlsx'new_file_chartgtp_path = os.getcwd() + f'/report/output/【{client_name}】月次レポート{report_month}_chatGTP.xlsx'# 复制模板文件shutil.copy2(template_to_client_path, new_file_to_client_path)shutil.copy2(template_chartgtp_path, new_file_chartgtp_path)# 现在我们可以打开新文件并处理数据# to_client fileworkbook_to_client = load_workbook(new_file_to_client_path)sheet_to_client = workbook_to_client['sheet1']# chatGPT fileworkbook_chatgpt = load_workbook(new_file_chartgtp_path)sheet_chatgpt = workbook_chatgpt['sheet1']# 设置边框样式,这里使用蓝色边框thin_border = Border(left=Side(border_style='thin', color='0070C0'),right=Side(border_style='thin', color='0070C0'),top=Side(border_style='thin', color='0070C0'),bottom=Side(border_style='thin', color='0070C0'))# 对齐方式: 水平居中 垂直居中alignment_center = Alignment(horizontal='center', vertical='center')# 对齐方式: 垂直居中vertical_center = Alignment(vertical='center')# 自动换行wrap_text_true = Alignment(wrap_text=True)# Fontfont_style = Font(name='Yu Gothic UI', size=11)row_cnt = len(records)# 插入数据for i in range(row_cnt):current_row = records[i]row_idx = i + 3# A列 NOcolumn_a = 'A' + str(row_idx)sheet_to_client[column_a] = '=ROW()-2'sheet_chatgpt[column_a] = '=ROW()-2'sheet_to_client[column_a].border = thin_border # 设置边框sheet_chatgpt[column_a].border = thin_border # 设置边框sheet_to_client[column_a].alignment = alignment_center # 对齐方式: 水平居中 垂直居中sheet_chatgpt[column_a].alignment = alignment_center # 对齐方式: 水平居中 垂直居中sheet_to_client[column_a].font = font_style # Fontsheet_chatgpt[column_a].font = font_style # Font# B列 対象日column_b = 'B' + str(row_idx)obj_date = str(current_row['date']).replace("-", "/")sheet_to_client[column_b] = obj_datesheet_chatgpt[column_b] = obj_datesheet_to_client[column_b].border = thin_border # 设置边框sheet_chatgpt[column_b].border = thin_border # 设置边框sheet_to_client[column_b].alignment = alignment_center # 对齐方式: 水平居中 垂直居中sheet_chatgpt[column_b].alignment = alignment_center # 对齐方式: 水平居中 垂直居中sheet_to_client[column_b].font = font_style # Fontsheet_chatgpt[column_b].font = font_style # Font# C列 投稿時刻column_c = 'C' + str(row_idx)obj_time = current_row['time']sheet_to_client[column_c] = obj_timesheet_chatgpt[column_c] = obj_timesheet_to_client[column_c].border = thin_border # 设置边框sheet_chatgpt[column_c].border = thin_border # 设置边框sheet_to_client[column_c].alignment = alignment_center # 对齐方式: 水平居中 垂直居中sheet_chatgpt[column_c].alignment = alignment_center # 对齐方式: 水平居中 垂直居中sheet_to_client[column_c].font = font_style # Fontsheet_chatgpt[column_c].font = font_style # Font# D列 URLcolumn_d = 'D' + str(row_idx)url = current_row['url']sheet_to_client[column_d] = urlsheet_chatgpt[column_d] = urlsheet_to_client[column_d].border = thin_border # 设置边框sheet_chatgpt[column_d].border = thin_border # 设置边框sheet_to_client[column_d].alignment = vertical_center # 垂直居中sheet_chatgpt[column_d].alignment = vertical_center # 垂直居中sheet_to_client[column_d].font = font_style # Fontsheet_chatgpt[column_d].font = font_style # Font# E列 タイトルcolumn_e = 'E' + str(row_idx)if current_row['category'] != "yelp":# yelp no titletitle = current_row['title']sheet_to_client[column_e] = titlesheet_chatgpt[column_e] = titlesheet_to_client[column_e].border = thin_border # 设置边框sheet_chatgpt[column_e].border = thin_border # 设置边框sheet_to_client[column_e].alignment = vertical_center # 垂直居中sheet_chatgpt[column_e].alignment = vertical_center # 垂直居中sheet_to_client[column_e].font = font_style # Fontsheet_chatgpt[column_e].font = font_style # Font# F列 サイトカテゴリcolumn_f = 'F' + str(row_idx)category = current_row['category'] + "検索結果"sheet_to_client[column_f] = categorysheet_chatgpt[column_f] = categorysheet_to_client[column_f].border = thin_border # 设置边框sheet_chatgpt[column_f].border = thin_border # 设置边框sheet_to_client[column_f].alignment = alignment_center # 对齐方式: 水平居中 垂直居中sheet_chatgpt[column_f].alignment = alignment_center # 对齐方式: 水平居中 垂直居中sheet_to_client[column_f].font = font_style # Fontsheet_chatgpt[column_f].font = font_style # Font# G列 ユーザー名column_g = 'G' + str(row_idx)user_name = current_row['user_name']sheet_to_client[column_g] = user_namesheet_chatgpt[column_g] = user_namesheet_to_client[column_g].border = thin_border # 设置边框sheet_chatgpt[column_g].border = thin_border # 设置边框sheet_to_client[column_g].alignment = alignment_center # 对齐方式: 水平居中 垂直居中sheet_chatgpt[column_g].alignment = alignment_center # 对齐方式: 水平居中 垂直居中sheet_to_client[column_g].font = font_style # Fontsheet_chatgpt[column_g].font = font_style # Font# H列 抜粋文column_h = 'H' + str(row_idx)content = current_row['content']sheet_to_client[column_h] = contentsheet_chatgpt[column_h] = contentsheet_to_client[column_h].border = thin_border # 设置边框sheet_chatgpt[column_h].border = thin_border # 设置边框sheet_to_client[column_h].alignment = vertical_center # 垂直居中sheet_chatgpt[column_h].alignment = vertical_center # 垂直居中sheet_to_client[column_h].alignment = wrap_text_true # 自动换行sheet_chatgpt[column_h].alignment = wrap_text_true # 自动换行sheet_to_client[column_h].font = font_style # Fontsheet_chatgpt[column_h].font = font_style # Font# I列 自動翻訳column_i = 'I' + str(row_idx)sheet_to_client[column_i] = ""# 判断语言, 非日语的才翻译if current_row['lang'] == 'Japanese':sheet_chatgpt[column_i] = contentelse:sheet_chatgpt[column_i] = f'=ChatGPT("将评论翻译成日语 " & H{row_idx})'sheet_to_client[column_i].border = thin_border # 设置边框sheet_chatgpt[column_i].border = thin_border # 设置边框sheet_to_client[column_i].alignment = vertical_center # 垂直居中sheet_chatgpt[column_i].alignment = vertical_center # 垂直居中sheet_to_client[column_i].alignment = wrap_text_true # 自动换行sheet_chatgpt[column_i].alignment = wrap_text_true # 自动换行sheet_to_client[column_i].font = font_style # Fontsheet_chatgpt[column_i].font = font_style # Font# J列 レベルcolumn_j = 'J' + str(row_idx)sheet_to_client[column_j] = f'= IF(COUNTIF(U{row_idx}, "*positive*")>0, "ポジティブ", "ネガティブ")'sheet_chatgpt[column_j] = f'= IF(COUNTIF(U{row_idx}, "*positive*")>0, "ポジティブ", "ネガティブ")'sheet_to_client[column_j].border = thin_border # 设置边框sheet_chatgpt[column_j].border = thin_border # 设置边框sheet_to_client[column_j].alignment = alignment_center # 对齐方式: 水平居中 垂直居中sheet_chatgpt[column_j].alignment = alignment_center # 对齐方式: 水平居中 垂直居中sheet_to_client[column_j].font = font_style # Fontsheet_chatgpt[column_j].font = font_style # Font# K列 商品関連column_k = 'K' + str(row_idx)sheet_to_client[column_k] = f'= IF(COUNTIF(U{row_idx}, "*商品関連*")>0, "●", "")'sheet_chatgpt[column_k] = f'= IF(COUNTIF(U{row_idx}, "*商品関連*")>0, "●", "")'sheet_to_client[column_k].border = thin_border # 设置边框sheet_chatgpt[column_k].border = thin_border # 设置边框sheet_to_client[column_k].alignment = alignment_center # 对齐方式: 水平居中 垂直居中sheet_chatgpt[column_k].alignment = alignment_center # 对齐方式: 水平居中 垂直居中# L列 接客関連column_l = 'L' + str(row_idx)sheet_to_client[column_l] = f'= IF(COUNTIF(U{row_idx}, "*接客関連*")>0, "●", "")'sheet_chatgpt[column_l] = f'= IF(COUNTIF(U{row_idx}, "*接客関連*")>0, "●", "")'sheet_to_client[column_l].border = thin_border # 设置边框sheet_chatgpt[column_l].border = thin_border # 设置边框sheet_to_client[column_l].alignment = alignment_center # 对齐方式: 水平居中 垂直居中sheet_chatgpt[column_l].alignment = alignment_center # 对齐方式: 水平居中 垂直居中# M列 店舗関連column_m = 'M' + str(row_idx)sheet_to_client[column_m] = f'= IF(COUNTIF(U{row_idx}, "*店舗関連*")>0, "●", "")'sheet_chatgpt[column_m] = f'= IF(COUNTIF(U{row_idx}, "*店舗関連*")>0, "●", "")'sheet_to_client[column_m].border = thin_border # 设置边框sheet_chatgpt[column_m].border = thin_border # 设置边框sheet_to_client[column_m].alignment = alignment_center # 对齐方式: 水平居中 垂直居中sheet_chatgpt[column_m].alignment = alignment_center # 对齐方式: 水平居中 垂直居中# N列 在庫関連column_n = 'N' + str(row_idx)sheet_to_client[column_n] = f'= IF(COUNTIF(U{row_idx}, "*在庫関連*")>0, "●", "")'sheet_chatgpt[column_n] = f'= IF(COUNTIF(U{row_idx}, "*在庫関連*")>0, "●", "")'sheet_to_client[column_n].border = thin_border # 设置边框sheet_chatgpt[column_n].border = thin_border # 设置边框sheet_to_client[column_n].alignment = alignment_center # 对齐方式: 水平居中 垂直居中sheet_chatgpt[column_n].alignment = alignment_center # 对齐方式: 水平居中 垂直居中# O列 在庫関連column_o = 'O' + str(row_idx)sheet_to_client[column_o] = f'= IF(COUNTIF(U{row_idx}, "*労務関連*")>0, "●", "")'sheet_chatgpt[column_o] = f'= IF(COUNTIF(U{row_idx}, "*労務関連*")>0, "●", "")'sheet_to_client[column_o].border = thin_border # 设置边框sheet_chatgpt[column_o].border = thin_border # 设置边框sheet_to_client[column_o].alignment = alignment_center # 对齐方式: 水平居中 垂直居中sheet_chatgpt[column_o].alignment = alignment_center # 对齐方式: 水平居中 垂直居中# P列 トラブル関連column_p = 'P' + str(row_idx)sheet_to_client[column_p] = f'= IF(COUNTIF(U{row_idx}, "*トラブル関連*")>0, "●", "")'sheet_chatgpt[column_p] = f'= IF(COUNTIF(U{row_idx}, "*トラブル関連*")>0, "●", "")'sheet_to_client[column_p].border = thin_border # 设置边框sheet_chatgpt[column_p].border = thin_border # 设置边框sheet_to_client[column_p].alignment = alignment_center # 对齐方式: 水平居中 垂直居中sheet_chatgpt[column_p].alignment = alignment_center # 对齐方式: 水平居中 垂直居中# Q列 著作権侵害関連column_q = 'Q' + str(row_idx)sheet_to_client[column_q] = f'= IF(COUNTIF(U{row_idx}, "*著作権侵害関連*")>0, "●", "")'sheet_chatgpt[column_q] = f'= IF(COUNTIF(U{row_idx}, "*著作権侵害関連*")>0, "●", "")'sheet_to_client[column_q].border = thin_border # 设置边框sheet_chatgpt[column_q].border = thin_border # 设置边框sheet_to_client[column_q].alignment = alignment_center # 对齐方式: 水平居中 垂直居中sheet_chatgpt[column_q].alignment = alignment_center # 对齐方式: 水平居中 垂直居中# R列 下請法関連column_r = 'R' + str(row_idx)sheet_to_client[column_r] = f'= IF(COUNTIF(U{row_idx}, "*下請法関連*")>0, "●", "")'sheet_chatgpt[column_r] = f'= IF(COUNTIF(U{row_idx}, "*下請法関連*")>0, "●", "")'sheet_to_client[column_r].border = thin_border # 设置边框sheet_chatgpt[column_r].border = thin_border # 设置边框sheet_to_client[column_r].alignment = alignment_center # 对齐方式: 水平居中 垂直居中sheet_chatgpt[column_r].alignment = alignment_center # 对齐方式: 水平居中 垂直居中# S列 その他column_s = 'S' + str(row_idx)sheet_to_client[column_s] = f'= IF(COUNTIF(U{row_idx}, "*その他*")>0, "●", "")'sheet_chatgpt[column_s] = f'= IF(COUNTIF(U{row_idx}, "*その他*")>0, "●", "")'sheet_to_client[column_s].border = thin_border # 设置边框sheet_chatgpt[column_s].border = thin_border # 设置边框sheet_to_client[column_s].alignment = alignment_center # 对齐方式: 水平居中 垂直居中sheet_chatgpt[column_s].alignment = alignment_center # 对齐方式: 水平居中 垂直居中# U列 chatGPT 分类的列column_u = 'U' + str(row_idx)sheet_to_client[column_u] = f''sheet_chatgpt[column_u] = f'=ChatGPT($U$1 & H{row_idx})'# 保存修改后的Excel文件workbook_to_client.save(new_file_to_client_path)workbook_chatgpt.save(new_file_chartgtp_path)# 设置打印区域# 参考文档: https://www.jianshu.com/p/75eb9342da59end_row = row_cnt + 2excel_app = win32com.client.Dispatch('Excel.Application')excel_app.Visible = Falseexcel_app.DisplayAlerts = Falsewb = excel_app.Workbooks.Open(new_file_to_client_path)ws = wb.Activesheetws.PageSetup.PrintArea = f"$A$2:$S${end_row}"wb.Save()excel_app.Quit()sns_logger.info(f'文件已创建并处理:{new_file_to_client_path}')sns_logger.info(f'文件已创建并处理:{new_file_chartgtp_path}')except Exception as e:sns_logger.error(e)return Falseif __name__ == '__main__':start_time = time.time() # 记录开始时间# in_clientsin_clients = sys.argv[1].lower()# init loginit_log(in_clients, 'report')# set log levelconf_env = env_argslog_level = log_level_args[conf_env]sns_logger.setLevel(log_level)sns_logger.info("========== Task Start!!! ==========")sns_logger.info("clinet_cds: {}".format(in_clients))if len(sys.argv) < 4:sns_logger.error("params not enough, please check your params")exit()# in_start_datein_start_date = sys.argv[2]sns_logger.info("start_date: {},".format(in_start_date))if not util.is_valid_date(in_start_date):sns_logger.error("invalid start_date: {}, date format should be yyyy-mm-dd".format(in_start_date))exit()# in_end_datein_end_date = sys.argv[3]sns_logger.info("end_date: {}".format(in_end_date))if not util.is_valid_date(in_end_date):sns_logger.error("invalid end_date: {}, date format should be yyyy-mm-dd".format(in_end_date))exit()run(in_clients, in_start_date, in_end_date)sns_logger.info("========== Task End!!! ==========")end_time = time.time() # 记录结束时间execution_time = end_time - start_timesns_logger.info("run(%s, %s, %s)" % (in_clients, in_start_date, in_end_date))sns_logger.info(f"程序执行了 {execution_time:.6f} 秒")
相关文章:
python 做成Excel并设置打印区域
记录首次用python处理Excel表格的过程。 参考文章:https://www.jianshu.com/p/5e00dc2c9f4c 程序要做的事情: 1. copy 模板文件到 output 文件夹并重命名为客户指定的文件名 2. 从 DB 查询数据并将数据写入 Excel 3. 写数据的同时, 设置每…...

SpringAI(二)
大模型:具有大规模参数和复杂计算结构的机器学习模型.通常由深度神经网络构建而成,拥有数十亿甚至数千亿个参数.其设计目的在于提高模型的表达能力和预测性能,应对复杂的任务和数据. SpringAI是一个AI工程领域的应用程序框架 大概推出时间是2023年7月份(不确定) 目的是将S…...

小白都可以通过U盘重装系统,再也不用花50块钱去安装系统啦
下载Ventoy 软件 1、今天带着大家通过Ventoy 安装Windows 11 系统。 2、首先我们通过官网如下地址:https://www.ventoy.net/cn/,找到我们对应系统的Ventoy 软件安装包。 3、通过官网可以找到软件包的地址地址,如下图所示。 4、如下就是我下…...
android 双屏异显-学习笔记
双屏异显 日常生活中,有时候会遇到 Android 设备连接两个屏幕进行显示的问题,比如酒店登记信息时,一个屏幕用于员工操作,一个屏幕显示相关信息供顾客查看。这里就涉及到 Android 的双屏异显的问题,实现Android 的双屏异显,Google 也提供了相应的 API方法 Presentation。…...

Android Lottie 体积优化实践:从 6.4 MB 降到 530 KB
一、说明 产品提出需求:用户有 8 个等级,每个等级对应一个奖牌动画。 按照常用的实现方式: 设计提供 8 个 lottie 动画(8 个 json 文件)。研发将 json 文件打包进入 APK 中。根据不同等级播放指定的动画。 每一个 …...
Django前端页面-模板继承
通过模板的继承,可以将所有共同的前端页面移到母版,那么其他页面就可以用到母版了。 这是母版 <!DOCTYPE html> <html><head>{% block css %}{% endblock %}</head><body><h1>母版</h1><div><!-- …...

使用HTML、CSS和JavaScript编写一个注册界面(一)
倘若文章或代码中有任何错误或疑惑,欢迎提出交流哦~ HTML和CSS 首先,我们需要编写一个简洁的注册界面。 简单编写下,如下: 呈现效果为: <!DOCTYPE html> <html lang"en"><head><me…...

什么是档案数字化管理
档案数字化管理指的是将传统的纸质档案转换为数字形式,并通过电子设备、软件和网络技术进行管理和存储的过程。 档案数字化管理包括以下几个步骤: 1. 扫描和数字化:将纸质档案通过扫描仪转换为数字图像或文档。可以使用OCR(光学字…...

vuInhub靶场实战系列--prime:1
免责声明 本文档仅供学习和研究使用,请勿使用文中的技术源码用于非法用途,任何人造成的任何负面影响,与本人无关。 目录 免责声明前言一、环境配置1.1 靶场信息1.2 靶场配置 二、信息收集2.1 主机发现2.1.1 netdiscover2.1.2 nmap主机扫描2.1.3 arp-scan主机扫描 2.2 端口扫描…...

L48---1637. 两点之间不包含任何点的最宽垂直区域(排序)---Java版
1.题目描述 2.思路 (1)返回两点之间内部不包含任何点的 最宽垂直区域 的宽度。 我的理解是相邻两个点,按照等差数列那样,后一个数减去相邻的前一个数,才能保证两数之间不含其他数字。 (2)所以&…...

在线渲染3d怎么用?3d快速渲染步骤设置
在线渲染3D模型是一种高效的技术,它允许艺术家和设计师通过互联网访问远程服务器的强大计算能力,从而加速渲染过程。无论是复杂的场景还是高质量的视觉效果,在线渲染服务都能帮助您节省宝贵的时间。 在线渲染3D一般选择的是:云渲染…...

《软件定义安全》之二:SDN/NFV环境中的安全问题
第2章 SDN/NFV环境中的安全问题 1.架构安全 SDN强调了控制平面的集中化,从架构上颠覆了原有的网络管理,所以SDN的架构安全就是首先要解决的问题。例如,SDN实现中网络控制器相关的安全问题。 1.1 SDN架构的安全综述 从网络安全的角度&…...
Qt图表类介绍
本文主要介绍QCharts相关的模块及类。 Qt中图表模块有以下几种类型:折线图,样条曲线图,面积图,散点图,条形图,饼图,方块胡须图,蜡烛图,极坐标图。 QCharts的图表框架类似…...

时隔很久运行苍穹外卖项目,出现很多错误
中途运行了很多其他项目,maven的配置文件还被我修改了一次。导致再次运行苍穹外卖项目出现很多错误。 发现没有办法,把本地的仓库删了个干干净净。然后点击clean发现报错: Cannot access alimaven (http://mavejavascript:void(0);n.aliyun.…...
补篇协程:协程(Coroutine)里通过挂起suspend函数实现异步IO操作
异步IO的概念 异步IO是一种非阻塞的数据读写方法,异步IO与同步IO相对。 当一个异步过程调用发出后,调用者不能立刻得到结果。 实际的IO处理部件在完成操作后,会通过状态、通知或回调机制来通知调用者。 在一个CPU密集型的应用中,…...

qmt量化交易策略小白学习笔记第16期【qmt编程之获取北向南向资金(沪港通,深港通和港股通)】
qmt编程之获取北向南向资金 qmt更加详细的教程方法,会持续慢慢梳理。 也可找寻博主的历史文章,搜索关键词查看解决方案 ! 北向南向资金(沪港通,深港通和港股通) #北向南向资金交易日历 获取交易日列表…...

开源项目学习——vnote
一、介绍 vnote是一款免费且开源的markdown编辑器,用C开发,基于Qt框架,windows/linux/mac都能用。 二、编译 $ git clone --recursive https://github.com/vnotex/vnote.git $ cd vnote && mkdir build $ cd build $ cmake ../ $ …...
5_1 Linux 计划任务
5_1 Linux 计划任务 文章目录 5_1 Linux 计划任务[toc]1. crontab 命令2. 计划任务书写格式 用途:按照设置的时间间隔,为用户反复执行某一固定的系统任务 软件包:cronie、crontabs 系统服务:crond 日志文件:/var/log/c…...
接口框架项目实战-pytest(六)csv数据驱动
csv 数据驱动 为了解决数据量大 导致yaml文件重复太多 yaml_util.py import osimport jsonpath import yamlfrom pytestdemo.common.base_util import get_path from pytestdemo.common.csv_util import analysis_parametersdef read_config_file(one_node,two_node):with ope…...

【Apache Doris】周FAQ集锦:第 5 期
【Apache Doris】周FAQ集锦:第 5 期 SQL问题数据操作问题运维常见问题其它问题关于社区 欢迎查阅本周的 Apache Doris 社区 FAQ 栏目! 在这个栏目中,每周将筛选社区反馈的热门问题和话题,重点回答并进行深入探讨。旨在为广大用户和…...

高频面试之3Zookeeper
高频面试之3Zookeeper 文章目录 高频面试之3Zookeeper3.1 常用命令3.2 选举机制3.3 Zookeeper符合法则中哪两个?3.4 Zookeeper脑裂3.5 Zookeeper用来干嘛了 3.1 常用命令 ls、get、create、delete、deleteall3.2 选举机制 半数机制(过半机制࿰…...

【快手拥抱开源】通过快手团队开源的 KwaiCoder-AutoThink-preview 解锁大语言模型的潜力
引言: 在人工智能快速发展的浪潮中,快手Kwaipilot团队推出的 KwaiCoder-AutoThink-preview 具有里程碑意义——这是首个公开的AutoThink大语言模型(LLM)。该模型代表着该领域的重大突破,通过独特方式融合思考与非思考…...

【JVM面试篇】高频八股汇总——类加载和类加载器
目录 1. 讲一下类加载过程? 2. Java创建对象的过程? 3. 对象的生命周期? 4. 类加载器有哪些? 5. 双亲委派模型的作用(好处)? 6. 讲一下类的加载和双亲委派原则? 7. 双亲委派模…...
Python 训练营打卡 Day 47
注意力热力图可视化 在day 46代码的基础上,对比不同卷积层热力图可视化的结果 import torch import torch.nn as nn import torch.optim as optim from torchvision import datasets, transforms from torch.utils.data import DataLoader import matplotlib.pypl…...
API网关Kong的鉴权与限流:高并发场景下的核心实践
🔥「炎码工坊」技术弹药已装填! 点击关注 → 解锁工业级干货【工具实测|项目避坑|源码燃烧指南】 引言 在微服务架构中,API网关承担着流量调度、安全防护和协议转换的核心职责。作为云原生时代的代表性网关,Kong凭借其插件化架构…...

Java后端检查空条件查询
通过抛出运行异常:throw new RuntimeException("请输入查询条件!");BranchWarehouseServiceImpl.java // 查询试剂交易(入库/出库)记录Overridepublic List<BranchWarehouseTransactions> queryForReagent(Branch…...

Appium下载安装配置保姆教程(图文详解)
目录 一、Appium软件介绍 1.特点 2.工作原理 3.应用场景 二、环境准备 安装 Node.js 安装 Appium 安装 JDK 安装 Android SDK 安装Python及依赖包 三、安装教程 1.Node.js安装 1.1.下载Node 1.2.安装程序 1.3.配置npm仓储和缓存 1.4. 配置环境 1.5.测试Node.j…...
深入理解 React 样式方案
React 的样式方案较多,在应用开发初期,开发者需要根据项目业务具体情况选择对应样式方案。React 样式方案主要有: 1. 内联样式 2. module css 3. css in js 4. tailwind css 这些方案中,均有各自的优势和缺点。 1. 方案优劣势 1. 内联样式: 简单直观,适合动态样式和…...

理想汽车5月交付40856辆,同比增长16.7%
6月1日,理想汽车官方宣布,5月交付新车40856辆,同比增长16.7%。截至2025年5月31日,理想汽车历史累计交付量为1301531辆。 官方表示,理想L系列智能焕新版在5月正式发布,全系产品力有显著的提升,每…...
基于Java项目的Karate API测试
Karate 实现了可以只编写Feature 文件进行测试,但是对于熟悉Java语言的开发或是测试人员,可以通过编程方式集成 Karate 丰富的自动化和数据断言功能。 本篇快速介绍在Java Maven项目中编写和运行测试的示例。 创建Maven项目 最简单的创建项目的方式就是创建一个目录,里面…...