diff --git a/ADC_function.py b/ADC_function.py index 30a5127..bcda6c9 100644 --- a/ADC_function.py +++ b/ADC_function.py @@ -18,6 +18,7 @@ from requests.adapters import HTTPAdapter from urllib3.util.retry import Retry from cloudscraper import create_scraper from concurrent.futures import ThreadPoolExecutor +from unicodedata import category def getXpathSingle(htmlcode, xpath): @@ -566,6 +567,7 @@ def delete_all_elements_in_list(string: str, lists: typing.Iterable[str]): new_lists.append(i) return new_lists + def delete_all_elements_in_str(string_delete: str, string: str): """ delete same string in given list @@ -573,4 +575,14 @@ def delete_all_elements_in_str(string_delete: str, string: str): for i in string: if i == string_delete: string = string.replace(i,"") - return string \ No newline at end of file + return string + + +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 diff --git a/core.py b/core.py index 0300b9e..6767996 100644 --- a/core.py +++ b/core.py @@ -608,7 +608,7 @@ def debug_print(data: json): if i == 'extrafanart': print('[+] -', "%-14s" % i, ':', len(v), 'links') continue - print('[+] -', "%-14s" % i, ':', v) + print(f'[+] - {i:<{cnspace(i,14)}} : {v}') print("[+] ------- DEBUG INFO -------") except: