Created
May 18, 2023 18:08
-
-
Save luabida/40ba690f7ae8c694961a6a2f16e7fd54 to your computer and use it in GitHub Desktop.
Normalize string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unicodedata | |
def normalize_str(string: str) -> str: | |
non_ascii = ( | |
unicodedata.normalize("NFKD", string).encode("ascii", "ignore").decode() | |
) | |
string = non_ascii.lower().replace(" ", "_") | |
return string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment