Home / Python Strings / How to Insert Characters That Are Illegal in a String in Python In this example we will show how to insert characters that are illegal in a string using an escape character in Python. Source Code my_str = "I love "Python"" print(my_str) Output: I love "Python"