1

I want to print enter name with raw_input color Below is the code it will first print enter name with color and then in next line i am reading input.

class bcolors:
   HEADER = '\033[95m'
   OKBLUE = '\033[94m'
   OKGREEN = '\033[92m'
   WARNING = '\033[93m'
   FAIL = '\033[91m'
   ENDC = '\033[0m'
   BOLD = '\033[1m'
   UNDERLINE = '\033[4m'
   print bcolors.WARNING + "Enter name:"  + bcolors.ENDC
   storage_select = raw_input()

But i want below thing with color

   a = raw_input("Enter name")
asteroid4u
  • 125
  • 1
  • 12
  • Possible duplicate of [How to print colored text in terminal in Python?](https://stackoverflow.com/questions/287871/how-to-print-colored-text-in-terminal-in-python) – Nazim Kerimbekov Apr 30 '19 at 21:40

1 Answers1

6
a = raw_input(bcolors.OKGREEN + "Enter name" + bcolors.ENDC)

It will only work on Linux though.

m0dem
  • 968
  • 1
  • 7
  • 14