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