例如:
转义非ASCII字符:
x = ascii("My name is Ståle")1、定义和用法
ascii()函数返回任何对象(字符串,元组,列表等)的可读版本。
ascii()函数将用转义符替换所有非ascii字符:
å将替换为\xe5。
2、调用语法
ascii(object)
3、参数说明
参数 | 描述 |
object | 对象,例如,字符串,列表,元组,字典等。 |
例如:
转义非ASCII字符:
x = ascii("My name is Ståle")ascii()函数返回任何对象(字符串,元组,列表等)的可读版本。
ascii()函数将用转义符替换所有非ascii字符:
å将替换为\xe5。
ascii(object)
参数 | 描述 |
object | 对象,例如,字符串,列表,元组,字典等。 |