How To Underline Text In Python
Last updated April 22, 2023 by Jarvis Silva
Looking for a way to print underline text in python then you are at the right place, today in this article I will show you how to underline text in python.
When I say underline text in python, I mean the python string text which gets printed in the terminal or console will print as underline text.
Print Underline Text in Python Code
print("\u0332".join("Hello"))
print("\u0332".join("How are you?"))
As you can see this is just one line of python code so to test this code you can run it in an online compiler or on your computer after running you should get an underline text printed in your console like below.
H̲e̲l̲l̲o
H̲o̲w̲ ̲a̲r̲e̲ ̲y̲o̲u?
So how did it print an underline text so we just used a regular print statement but with a unicode “\u0332” which makes a word underline so we use the join string method to add it to our string or text.
This was a short tutorial on how to print underline a text in python, I hope you found what you were looking for.
Here are more python guides you may find helpful:
- How to convert days to hours in python.
- How to convert wav to mp3 in python.
- How to convert minutes to hours in python.
I hope you found this article helpful, if you did, do share it with others who need this and also join our Telegram channel for future tutorials like this.
Thanks for reading, have a nice day 🙂