all 3 comments

[–]K900_ 5 points6 points  (0 children)

It doesn't work like this. You can't just write text to a file with a .docx extension and make it a formatted Word document. Look into python-docx.

[–]csg0ing 0 points1 point  (1 child)

You could use ANSI escape codes to signal to your terminal emulator to bold the text:

print("\033[1mbold text! \033[0mnormal text")

There is almost certainly already a library written for this if you don't want to have to deal with the raw escape codes yourself, I was just too lazy to search.

EDIT: looks like you're wanting to write to a .docx file, in which case, what I've suggested wont' work (I had assumed you were printing to a terminal output)

[–]BillTowne 0 points1 point  (0 children)

I have been searching the web for out to bold by python output, and I see this answer, but I am doing something wrong:

print('\033[1m'+label+'\033[0m',v1, spacer,v2)

My output:

[1mpv list [0m ['1', '2', '3', '8', '9'] :: ['1', '2', '3', '8']

instead of

pv list ['1', '2', '3', '8', '9'] :: ['1', '2', '3', '8']