import unicodedata | |
def _remove_non_string_characters(string): | |
symbols_to_remove = ["Δ"] | |
return "".join( | |
char | |
for char in string | |
if unicodedata.category(char)[0] in {"L", "N", "P", "Z"} | |
and char not in symbols_to_remove | |
) | |
def compare_strings_ignore_non_string(string1, string2): | |
string1 = _remove_non_string_characters(string1) | |
string2 = _remove_non_string_characters(string2) | |
if string1 != string2 and string1[0:20] == string2[0:20]: | |
print(f"String1: {string1}") | |
print(f"String2: {string2}") | |
return string1 == string2 | |