how to bold in python code example

Example 1: print bold python

print('\033[1m' + 'Text' + '\033[0m')

Example 2: count_values in python

idx.value_counts()

Example 3: how to bold in colorama

from simple_colors import *
print(green('hello', 'bold'))

Example 4: bold some letters of string in python

from __future__ import unicode_literals, print_function
from prompt_toolkit import print_formatted_text, HTML

print_formatted_text(HTML('<b>This is bold</b>'))
print_formatted_text(HTML('<i>This is italic</i>'))
print_formatted_text(HTML('<u>This is underlined</u>'))

Example 5: non-words in python

import re

regex = re.compile('[^a-zA-Z]')
#First parameter is the replacement, second parameter is your input string
regex.sub('', 'ab3d*E')
#Out: 'abdE'