Explore

Close
HowTos Share

How To Underline Text In Python

How To Print Underline Text In Python

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.

It is quite easy and simple to print underline text in python or print underline string in python now let’s see it in code.

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 this.

Output


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.

I hope you understood how this works and you were able to run this program successfully.

Summary

So this was a short tutorial on how to underline a text in python or how to underline a string in python. I hope you found what you were looking for.

Here are more python guides you may find helpful:

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 guides like this.

Thanks for reading, have a nice day 🙂