Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Coloring parts of string with termcolor & colorama

So until now I have been creating variables such as "coloredPrice" to hold colored strings. But it is just so fucking retarded.

Example:
PHP Code

<?php 
print("Sending order of " + coloredBuyAmount + " Bitcoins . . .") 

And this is coloredBuyAmount:
PHP Code

<?php 
coloredBuyAmount 
= colored(str(buyAmount), "yellow", attrs=['bold']) 

That works fine, but I feel like there must be an easier way, I'm just not very experienced with termcolor & colorama.

I would want something like this:
PHP Code

<?php 
cprint
("This color is grey " + colored("but this is green", "green")) 
Which I would want to print this: This color is grey but this is green

But that doesn't work

Very much appreciated!

EDIT im more retarded than i thought. the example code i showed worked


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by MordiciaNov 15, 2019 07:21 PM 3 211 Nov 15, 2019 07:21 PM
Last Post: Mordicia
[Java] by pureaccaMay 12, 2017 12:57 PM 10 607 May 12, 2017 12:57 PM
Last Post: ComplexEternity
[Shell] by Alumni TheoristJul 19, 2016 01:52 AM 11 541 Jul 19, 2016 01:52 AM
Last Post: Aggelos