Results 1 to 3 of 3

Thread: Change color of text in python

  1. #1
    Join Date
    Nov 2007
    Location
    México, D.F.
    Beans
    30
    Distro
    Ubuntu 11.04 Natty Narwhal

    Change color of text in python

    Is it possible to change the color of the text output in python running in terminal?

  2. #2
    Join Date
    Feb 2007
    Beans
    847

    Re: Change color of text in python

    http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html

    Code:
    #! /usr/bin/python
    
    print "\033[34mThis is blue\033[0m"

  3. #3
    Join Date
    Jul 2011
    Beans
    1

    Re: Change color of text in python

    For some reason it only appears:
    [31mRed Text
    on my python shell when I write the code:

    #! /usr/bin/python
    print('\033[31mRed Text\033[0m')

    Can someone please help me?

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •