文档更新,代码更新

This commit is contained in:
2023-09-24 02:14:04 +08:00
parent 7c078be0cf
commit 732dd0453d
8 changed files with 218 additions and 235 deletions

View File

@ -178,3 +178,39 @@ def format_ipt(
prt(err_note)
continue
return result, fun_result
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
# 真假字符串判断
def bool_str(sth: str):
try:
return bool(float(sth))
except:
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:
try:
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("",'.'))
except:
raise ValueError
def int_str(sth: str):
try:
return int(float_str(sth))
except ValueError:
raise ValueError