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 Top answer 1 of 16
661
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)
2 of 16
120
Use this:
print '\033[1m' + 'Hello'
And to change back to normal:
print '\033[0m'
This page is a good reference for printing in colors and font-weights. Go to the section that says 'Set graphics mode:'
And note this won't work on all operating systems but you don't need any modules.
Reddit
reddit.com › r/learnpython › how do i print bold text?
r/learnpython on Reddit: How do I print bold text?
April 24, 2021 -
I've Googled it, and the only answer I've come across so far is
class color:
start = '\033[1m'
end = '\033[0m'
print(color.start + 'something' + color.end)
But the output this provides is <-1m<-something<-0m<-.
Why?
Top answer 1 of 3
2
Guys thanks a bunch for the help, I finally was able to do it. Although it didn't bold it as expected, it Highlighted the background to an ash tint. If other noobs like me stumble upon this and wonder how to do so, here are the steps : Download the Colorama module. Start your cmd and type: pip3 install colorama Go to your file that you want the colored fonts in. Type the following : import colorama from colorama import Style colorama.init() And then the rest of your code, Finally for the particular words to be colored, 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' Syntax: word = '\033[94'(code for your desired color) + 'string' + '\033[0m'(end tag)
2 of 3
1
How are you running your code?
05:10
Print Colorful Text in Python – Easy Terminal Styling with Colorama ...
00:57
Format Text In Python #python #code #programming - YouTube
Highlighting Text in Python: Print Bold Text Without Escape ...
python print bold text
03:34
how to make user input bold in python - YouTube
03:08
python f string bold - YouTube
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.
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.
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 ·
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()
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.
Beautiful Soup
tedboy.github.io › python_stdlib › generated › generated › pydoc.TextDoc.bold.html
pydoc.TextDoc.bold — Python Standard Library
Format a string in bold by overstriking.
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'))
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.