class color:
   PURPLE = '\033[95m'
   CYAN = '\033[96m'
   DARKCYAN = '\033[36m'
   BLUE = '\033[94m'
   GREEN = '\033[92m'
   YELLOW = '\033[93m'
   RED = '\033[91m'
   BOLD = '\033[1m'
   UNDERLINE = '\033[4m'
   END = '\033[0m'

print(color.BOLD + 'Hello, World!' + color.END)
Answer from Bacara on Stack Overflow
People also ask

Why is bold text formatting important in Python?
Bold text formatting in Python is important because it enhances code readability. It allows you to highlight important parts of your code, making it easier to understand and follow.
🌐
codingdeeply.com
codingdeeply.com › home › master bold text in python: enhance your code’s readability today!
Master Bold Text in Python: Enhance Your Code's Readability Today!
How can I create bold Python text without third-party libraries?
One way to create bold text in Python without third-party libraries is by using ANSI escape sequences. These sequences allow you to format text in the terminal, making it bold.

You can find examples and explanations of the syntax and usage of ANSI escape sequences in our section on using ANSI escape sequences for bold text.
🌐
codingdeeply.com
codingdeeply.com › home › master bold text in python: enhance your code’s readability today!
Master Bold Text in Python: Enhance Your Code's Readability Today!
How can I start incorporating bold text formatting in my Python projects today?
To start incorporating bold text formatting in your Python projects, we recommend reading through our sections on understanding text formatting in Python, using ANSI escape sequences for bold text, and styling text with third-party libraries.

These sections provide all the information you need to get started and enhance the aesthetics and effectiveness of your code.
🌐
codingdeeply.com
codingdeeply.com › home › master bold text in python: enhance your code’s readability today!
Master Bold Text in Python: Enhance Your Code's Readability Today!
🌐
Python Software Foundation
wiki.python.org › psf › HelpOnFormatting.html
HelpOnFormatting
If a change to this archive is absolutely needed, requests can be made via the infrastructure@python.org mailing list. Contents · Formatting · General · Typeface · Colorize text · Colorize code (Syntax Highlighting) Examples · Mixing ''italic'' and '''bold''' Superscript & Subscript ·
🌐
GitHub
github.com › bobbyhadz › how-to-print-bold-text-in-python › blob › main › main.py
how-to-print-bold-text-in-python/main.py at main · bobbyhadz/how-to-print-bold-text-in-python
A repository for an article at https://bobbyhadz.com/blog/how-to-print-bold-text-in-python - how-to-print-bold-text-in-python/main.py at main · bobbyhadz/how-to-print-bold-text-in-python
🌐
Kodeclik
kodeclik.com › how-to-bold-text-in-python
How to Bold Text in Python
October 23, 2024 - These codes are sequences of characters that, when printed to the terminal, modify the text's appearance. To make text bold, we'll use the ANSI escape code for bold text, which is \033[1m.
🌐
Quora
quora.com › How-can-you-make-text-bold-in-Python-What-is-the-difference-between-bold-text-and-regular-text-in-Python
How to make text bold in Python? What is the difference between bold text and regular text in Python - Quora
Answer (1 of 2): Main Python 's interface is CLI. (A terminal or virtual terminal) Most modern terminals accepts and interprets ANSI ESCAPE CODES, that lets you not only set bold fonts, but also change characters and background colors, and much more very useful things For example: (ESC)[34;42m...
Find elsewhere
🌐
Facebook
facebook.com › groups › python › posts › 1163615671145662
How to write bold text to a file in Python
Popular groups · Find communities for you · Over 1 billion people across the globe are using Facebook Groups to explore their favorite topics · Log in · Categories · Science & tech · Travel · Animals · Sports & fitness · Entertainment
🌐
Plotly
community.plotly.com › dash python
How can I show a bold text output? - Dash Python - Plotly Community Forum
May 10, 2021 - Hi, I have a problem with output text. I have a dashboard and I wanna show the ‘Last time’ value as date (YYYY-MM-DD), I was planned to show a led display like this. But it is not working with something different from integer. And after this, I tried to show as bold text output. like: html.H4("Last Training Date is: xxxx-xx-xx", style={"font-weight": "bold"}) But I couldn’t find how can I do.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-output-formatting
Python - Output Formatting - GeeksforGeeks
In Python, output formatting refers to the way data is presented when printed or logged. Proper formatting makes information more understandable and actionable.
Published: July 11, 2025
🌐
IncludeHelp
includehelp.com › python › bold-text-label-in-plot.aspx
Bold Text Label in Python Plot
July 23, 2020 - import numpy as np import matplotlib.pyplot as plt x = np.arange(0.1, 5, 0.1) y = np.tan(x)*np.exp(-x) #Lowercase Delta #In text plt.figure() plt.plot(x,y, '.-', color='purple') plt.title('Example') plt.text(4, -0.8, 'Bold Text', fontsize=14.0, fontweight='bold') plt.grid() plt.show() #In title plt.figure() plt.plot(x,y, '.-', color='purple') plt.title('Title', fontweight='bold') plt.grid() plt.show() #In x-axis label plt.figure() plt.plot(x,y, '.-', color='purple') plt.xlabel('x-Axis', fontweight='bold') plt.grid() plt.show() #In y-axis label plt.figure() plt.plot(x,y, '.-', color='purple') plt.ylabel('Variation', fontweight='bold') plt.grid() plt.show()
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-make-a-label-bold-tkinter
How To Make A Label Bold Tkinter? - GeeksforGeeks
July 23, 2025 - Tkinter has various customization settings that allow you to modify the appearance of GUI elements, including labels. Making a label bold can be achieved using different methods, such as configuring the font directly or using styles.
🌐
Codemia
codemia.io › home › knowledge hub › how can i print bold text in python?
How can I print bold text in Python? | Codemia
September 24, 2025 - Bold text in Python is environment-dependent, not universally handled by print.
🌐
Saturn Cloud
saturncloud.io › blog › making-everything-bold-in-matplotlib-with-python-a-guide
Making Everything Bold in Matplotlib with Python: A Guide | Saturn Cloud Blog
May 1, 2026 - In this code snippet, we first import the necessary modules. Then, we use the rcParams dictionary to set the font weight to ‘bold’. This will apply to all text elements in the plot.
🌐
GeeksforGeeks
geeksforgeeks.org › python › fontstyle-module-in-python
Fontstyle module in Python - GeeksforGeeks
January 17, 2022 - Here, we apply various formatting arguments like font color, background color, bold, italic on the given string. ... # import required module import fontstyle # display formatted text print(fontstyle.apply('GEEKSFORGEEKS', 'bold/Italic/red/UNDERLINE/GREEN_BG')) print(fontstyle.apply('GEEKSFORGEEKS', 'bold/Italic/red/INVERSE/UNDERLINE/GREEN_BG'))
🌐
Python documentation
docs.python.org › 3 › tutorial › inputoutput.html
7. Input and output — Python 3.15.0 documentation
So far we’ve encountered two ways of writing values: expression statements and the print() function. (A third way is using the write() method of file objects; the standard output file can be referenced as sys.stdout.
🌐
Real Python
realpython.com › python-print
Your Guide to the Python print() Function – Real Python
July 3, 2026 - Language: Python · >>> def esc(*codes): ... return f"\033[{';'.join(str(code) for code in codes)}m" ... >>> print(esc(31, 1, 4) + "really" + esc(0) + " important") This would make the word really appear in red (31), bold (1), and underlined (4) font: However, there are higher-level abstractions over ANSI escape codes, such as the mentioned colorama library, as well as tools for building full-fledged user interfaces in the console.
🌐
Narkive
tutor.python.narkive.com › h6HGJqWC › print-a-line-in-idle-as-bold-italics-or-a-color
[Tutor] print a line in IDLE as bold, italics or a color
Say I want to print the text (in the mentioned format): This is bold, red, blue, italics How do I do this in python 2.2 and using IDLE? Hi Victor, You may need to open up a special window for doing text displays with some variety.