2025-05-28 19:16:17 +08:00

34 lines
644 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import hashlib
import re
def trim_space(input_str):
result = re.sub(' {2,}', ' ', input_str)
return result
def get_str_md5(param_str):
if isinstance(param_str, str):
param_str = param_str.encode("utf-8")
m = hashlib.md5()
m.update(param_str)
return m.hexdigest()
def transform_full_width_number(input_str):
d = {
'': '0',
'': '1',
'': '2',
'': '3',
'': '4',
'': '5',
'': '6',
'': '7',
'': '8',
'': '9'
}
for _ in d:
input_str = input_str.replace(_, d[_])
return input_str