How do I print something underlined in Python?

Ricky Su picture Ricky Su · Feb 15, 2016 · Viewed 21k times · Source
print("hello")

The output should be the word "hello", but underlined.

Answer

Akira Okumura picture Akira Okumura · Feb 15, 2016

You can do it by using escape characters.

print("\033[4mhello\033[0m")