diff --git a/ADC_function.py b/ADC_function.py index bcda6c9..8165019 100644 --- a/ADC_function.py +++ b/ADC_function.py @@ -578,11 +578,6 @@ def delete_all_elements_in_str(string_delete: str, string: str): return string +# print format空格填充对齐内容包含中文时的空格计算 def cnspace(v: str, n: int) -> int: - """ - print format空格填充对齐内容包含中文时的空格计算 - """ - cw = 0 - for c in v: - cw += 1 if category(c) in ('Lo',) else 0 - return n - cw + return n - [category(c) for c in v].count('Lo') diff --git a/config.py b/config.py index 4dc0a9f..4cd17a8 100644 --- a/config.py +++ b/config.py @@ -181,15 +181,9 @@ class Config: if value.isnumeric() and int(value) >= 0: return int(value) sec = 0 - sv = re.findall(r'(\d+)s', value, re.I) - mv = re.findall(r'(\d+)m', value, re.I) - hv = re.findall(r'(\d+)h', value, re.I) - for v in sv: - sec += int(v) - for v in mv: - sec += int(v) * 60 - for v in hv: - sec += int(v) * 3600 + sec += sum(int(v) for v in re.findall(r'(\d+)s', value, re.I)) + sec += sum(int(v) for v in re.findall(r'(\d+)m', value, re.I)) * 60 + sec += sum(int(v) for v in re.findall(r'(\d+)h', value, re.I)) * 3600 return sec def is_translate(self) -> bool: