From 6f1c68c8e48d0efae98078da98f434f83dcdf7be Mon Sep 17 00:00:00 2001 From: wangweiye7840 Date: Tue, 26 Mar 2024 17:37:27 +0800 Subject: [PATCH] =?UTF-8?q?database=5Ftools=E6=96=B0=E5=A2=9Eusagelistdiff?= =?UTF-8?q?erence=E6=AF=94=E8=BE=83=E4=B8=A4=E4=B8=AA=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E7=8E=87=E8=AE=B0=E5=BD=95=E5=88=97=E8=A1=A8(=E5=8F=AF?= =?UTF-8?q?=E5=A4=9A=E5=B0=8F=E9=A2=98)=E7=9A=84=E5=B7=AE=E5=BC=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 工具v2/database_tools.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/工具v2/database_tools.py b/工具v2/database_tools.py index 4feeb207..c02fd842 100644 --- a/工具v2/database_tools.py +++ b/工具v2/database_tools.py @@ -2170,5 +2170,15 @@ def PaintRedAnswers(string,prodict): #将prodict中已有的答案标红色 return output +def usagelistdifference(lista,listb): #比较两个usage数组的最大差别(绝对值), 数组长度不一致则返回1 + if len(lista) != len(listb): + return 1 + else: + maxdiff = 0 + for i in range(len(lista)): + maxdiff = max(abs(float(lista[i])-float(listb[i])),maxdiff) + return maxdiff + + if __name__ == "__main__": print("数据库工具, import用.") \ No newline at end of file