Ma Lin <malin...@163.com> added the comment: In this case, you can only use 'latin1', which directly map one character (\u0000-\u00FF) to/from one byte.
If use 'utf-8', it may map one character to multiple bytes, such as 'Δ' -> b'\xce\x94' '\x94' is an invalid identifier, it will raise an error: >>> '\xce'.isidentifier() # '\xce' is 'Î' True >>> '\x94'.isidentifier() False You may close this issue (I can't close it), we can continue the discussion. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40980> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com