Jan-17-2017, 02:11 PM
Hello there,
I am using the package 'subprocess' to call some programs with parameter shell=True. Now I wish to change the color of the produced output. My system is Linux Ubuntu 15 with python3.5
Can someone help me?
My latest approach:
Aquaplant
I am using the package 'subprocess' to call some programs with parameter shell=True. Now I wish to change the color of the produced output. My system is Linux Ubuntu 15 with python3.5
Can someone help me?
My latest approach:
import subprocess print("Some text in default color.") subprocess.run(['echo -e "\033[32m"', 'ls -l', 'echo -e "\033[0m"'], shell=True) print("Hopefully some text in default color, again.")Produces:
Output:Some text in default color.
-e
Hopefully some text in default color, again. <- this is now green
Process finished with exit code 0
I want something like this:Output:Some text in default color.
#from now on in green
total 2088
-rw-rw-r-- 1 aq aq 1990 Sep 29 22:08 bibtexCheck.py
-rw-rw-r-- 1 aq aq 1936333 Jan 10 10:23 argparse
#from now on in default color
Hopefully some text in default color, again.
Thanks a lot,Aquaplant