+ 4

Colored Output in Python

https://sololearn.com/compiler-playground/ckubkU1SQpUw/?ref=app In general, how can I make a python code’s output colored? Specifically in my code, how can I make the letters in output colored? Especially I want only the characters to be colored, while the ‘-‘ signs to be left as they are.

13th Dec 2023, 12:17 PM
Levon Hovsepyan
Levon Hovsepyan - avatar
5 Antworten
+ 7
Levon Hovsepyan the easiest way on sololearn is to use open('.png','w').write('') And then style as you would on any natural html document. https://sololearn.com/compiler-playground/clhZHyRf59J6/?ref=app
13th Dec 2023, 2:42 PM
BroFar
BroFar - avatar
+ 2
https://pypi.org/project/colorama/ you could try this, although i don't believe it works in the sololearn code playground
13th Dec 2023, 2:10 PM
Angelo Abi Hanna
Angelo Abi Hanna - avatar
+ 2
you can also make it bold using BroFar 's method print('<strong>hello</strong>') open('.png','w').write('') print('''<style>img{display:none;}</style>''')
13th Dec 2023, 3:30 PM
Angelo Abi Hanna
Angelo Abi Hanna - avatar
+ 1
okkarsoe matthew if you were working on a in-lesson playground you can click on 'reset' from options to get the template back. I don't think there's a way to get back written code if it's deleted though. You can try looking for it by going to 'my code bits' and see if you can find what you want there. Also create a new question for this so people can help you out.
15th Dec 2023, 2:41 PM
Mohammed shoaib