ascii()
text = "Hello\nWorld"
print(ascii(text)) # Выведет "'Hello\\nWorld'"lst = ["Hello\tWorld", "Python\u2122"]
print(ascii(lst)) # Выведет "['Hello\\tWorld', 'Python\\u2122']"dictionary = {"Key\n": "Value\t"}
print(ascii(dictionary)) # Выведет "{'Key\\n': 'Value\\t'}"class MyClass:
def __repr__(self):
return "Object\u2122"
obj = MyClass()
print(ascii(obj)) # Выведет "Object\\u2122"Последнее обновление