In this article, you will see how to strikethrough a string in Python. To strikethrough a string in Python, you can use the string format()
method. In the below code, 9m{}
is used to strikethrough a string.
Step 1: Create a string
str = "CodeAllow" print("str = ", str) print("str type = ", type(str))
Step 2: Strikethrough string
print("str = ", "\033[9m{}\033[0m".format(str))
Output:
str = CodeAllow
str type = <class 'str'>
str = CodeAllow
Free resources to learn advanced skills: AiHints and CodeAllow