减一点图片大小

This commit is contained in:
EillesWan 2024-11-09 15:20:27 +08:00
parent 6355f7c935
commit 3e0ddccb5a
9 changed files with 64 additions and 62 deletions

View File

@ -1,62 +0,0 @@
def isin(sth: str, range_list: dict):
sth = sth.lower()
for bool_value, res_list in range_list.items():
if sth in res_list:
return bool_value
raise ValueError(
"不在可选范围内:{}".format([j for i in range_list.values() for j in i])
)
# 真假字符串判断
def bool_str(sth: str):
try:
return bool(float(sth))
except ValueError:
if str(sth).lower() in ("true", "", "", "y", "t"):
return True
elif str(sth).lower() in ("false", "", "", "f", "n"):
return False
else:
raise ValueError("非法逻辑字串")
def float_str(sth: str):
try:
return float(sth)
except ValueError:
return float(
sth.replace("", "1")
.replace("", "2")
.replace("", "3")
.replace("", "4")
.replace("", "5")
.replace("", "6")
.replace("", "7")
.replace("", "8")
.replace("", "9")
.replace("", "0")
.replace("", "1")
.replace("", "2")
.replace("", "3")
.replace("", "4")
.replace("", "5")
.replace("", "6")
.replace("", "7")
.replace("", "8")
.replace("", "9")
.replace("", "0")
.replace("", "0")
.replace("", "1")
.replace("", "2")
.replace("", "2")
.replace("", "7")
.replace("", ".")
)
def int_str(sth: str):
return int(float_str(sth))

View File

@ -1,6 +1,8 @@
import zhDateTime
from typing import Optional
def hanzi_timeid(
zhd: Optional[zhDateTime.zhDateTime] = None,
) -> str:
@ -28,3 +30,65 @@ def hanzi_timeid(
+ ("" if (zhd.microseconds) else "")
),
).strip()
# def isin(sth: str, range_list: dict):
# sth = sth.lower()
# for bool_value, res_list in range_list.items():
# if sth in res_list:
# return bool_value
# raise ValueError(
# "不在可选范围内:{}".format([j for i in range_list.values() for j in i])
# )
# # 真假字符串判断
# def bool_str(sth: str):
# try:
# return bool(float(sth))
# except ValueError:
# if str(sth).lower() in ("true", "真", "是", "y", "t"):
# return True
# elif str(sth).lower() in ("false", "假", "否", "f", "n"):
# return False
# else:
# raise ValueError("非法逻辑字串")
# def float_str(sth: str):
# try:
# return float(sth)
# except ValueError:
# return float(
# sth.replace("壹", "1")
# .replace("贰", "2")
# .replace("叁", "3")
# .replace("肆", "4")
# .replace("伍", "5")
# .replace("陆", "6")
# .replace("柒", "7")
# .replace("捌", "8")
# .replace("玖", "9")
# .replace("零", "0")
# .replace("一", "1")
# .replace("二", "2")
# .replace("三", "3")
# .replace("四", "4")
# .replace("五", "5")
# .replace("六", "6")
# .replace("七", "7")
# .replace("八", "8")
# .replace("九", "9")
# .replace("", "0")
# .replace("洞", "0")
# .replace("幺", "1")
# .replace("俩", "2")
# .replace("两", "2")
# .replace("拐", "7")
# .replace("点", ".")
# )
# def int_str(sth: str):
# return int(float_str(sth))

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 MiB

After

Width:  |  Height:  |  Size: 3.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 MiB

After

Width:  |  Height:  |  Size: 4.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 MiB

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 MiB

After

Width:  |  Height:  |  Size: 449 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 MiB

After

Width:  |  Height:  |  Size: 3.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 MiB

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 MiB

After

Width:  |  Height:  |  Size: 2.5 MiB