Importing texts from MS document then transforming them into bold texts in python

Viewed 18

I wanted to import texts from word document then transform them into bold (depending on the word lenght) then put the texts back into word document. For example: I take words into a list or tuple

test_word = "here is a sentnce u can print out in differnt collers and bold the text"

print (test_word.split())

output:

['here', 'is', 'a', 'sentnce', 'u', 'can', 'print', 'out', 'in', 'differnt', 'collers', 'and', 'bold', 'the', 'text']

Then I wanted to take the output even transform it depending on the len of the string I wanted to bold certain texts:

['here', 'is', 'a', 'sentnce', 'u', 'can', 'print', 'out', 'in', 'differnt', 'collers', 'and', 'bold', 'the', 'text'] etc

So far I could not find real bold in python modules is there any python modules that works with MS word?:

class color:

   PURPLE = '\033[95m'
   CYAN = '\033[96m'
   DARKCYAN = '\033[36m'
   BLUE = '\033[94m'
   GREEN = '\033[92m'
   YELLOW = '\033[93m'
   RED = '\033[91m'
   BOLD = '\033[1m'
   UNDERLINE = '\033[4m'
   END = '\033[0m'

print(color.BOLD + 'Hello World !' + color.END)
1 Answers
Related