ascii
Return an ASCII-only representation of an object.
返回一个表示对象的字符串
As repr(), return a string containing a printable representation of an
object, but escape the non-ASCII characters in the string returned by
repr() using \x, \u or \U escapes. This generates a string similar
to that returned by repr() in Python 2.
eg:
a={"a":"1","b":"2"}
print(type(a))
print(type(ascii(a)))
结果
<class 'dict'>
<class 'str'>