How can i put formated text in python? (bold, italic, etc.)
formated text in python? (bold, italic, etc.)
Tricker red = '\033[91m' green = '\033[92m' blue = '\033[94m' bold = '\033[1m' italics = '\033[3m' underline = '\033[4m' end = '\033[0m' print (red + underline + 'Test!... Test!' + end) something like this?
A little more pythonic Module: https://gist.github.com/dnmellen/5584007 import colors with colors.pretty_output(colors.BOLD, colors.FG_GREEN) as out: out.write("This is a bold green text") with colors.pretty_output(colors.BG_BLUE) as out: out.write("This output have a blue background but you " + colors.BOLD + colors.FG_RED + "can" + colors.END + " mix styles")
Thanks for the help Ruben Gasparyan
You are welcome!
Hi, for example from terminal import render print render('%(BG_YELLOW)s%(RED)s%(BOLD)sHey this is a test%(NORMAL)s') print render('%(BG_GREEN)s%(RED)s%(UNDERLINE)sAnother test%(NORMAL)s') you can change background color, color and formated text
You can also do it by using custom gui shell or ANSI escape characters. For Bold it's , "\033[3m" E.g. print('\003[3m' + 'Your text here' + '\033[0m') Always end your string with '\033[0m' There are many more formats available, use wiki for that. However, Sololearn shell doesn't support ANSI chars, therefore it is not possible here.
Ayush Dwivedi 🇮🇳 yes. You can also use semi colon for multi formatting.
I have made a calculator in which my % (Percentage) not work correctly for 100%50 or 100%20.
Python palindrome challenge.
I have a problem in html in the third practice in the third lesson there is a cv project how will I do they said wrap the code u