def convert_symbols_to_fullwidth(text): half_symbols = '!?~' full_symbols = '!?〜' half_to_full = {half: full for half, full in zip(half_symbols, full_symbols)} return ''.join(half_to_full.get(char, char) for char in text) def convert_fullwidth_digits_to_halfwidth(text): full_digits = '0123456789' half_digits = '0123456789' full_to_half = {full: half for full, half in zip(full_digits, half_digits)}