Skip to content

Instantly share code, notes, and snippets.

@nlpjoe
Last active September 3, 2020 08:05
Show Gist options
  • Save nlpjoe/06908b111ace6a52b9e560e8fc318e24 to your computer and use it in GitHub Desktop.
Save nlpjoe/06908b111ace6a52b9e560e8fc318e24 to your computer and use it in GitHub Desktop.
[pai工具] #coding
def str_normalize(s):
    if isinstance(s, bytes):
        s = s.decode("utf-8")
    out_s = s.encode("utf-8")
    if not isinstance(out_s, str):
        out_s = out_s.decode("utf-8")
    return out_s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment