I am trying to print this statement:
a= 'Hi %s, \n The meeting is scheduled for %s %sth \n if you have an questions please contact %s' % (cfname, meetingmonth, meetingday, cleadfname)
print a
I'm also trying to bold every variable insert (i.e. cfname, meetingmonth etc.). Basically, I have a script asking the enduser for input which writes this statement to a .doc format. Is there a simple way to bold things when writing something in python?
I've tried the bold brackets around the word and that doesn't seem to work. Any help would be great!
print produces plain text, not Microsoft Word documents. If you add HTML formatting tags (<html>, <body>, <strong>, <br />, etc.) where necessary, then give the resulting text file the .doc extension, it will open with Word, which - assuming you have a reasonably recent version that understands HTML - will parse the HTML and display the result you're looking for.
Sample:
a= '<html><head></head><body>Hi %s, </br> The meeting is scheduled for <strong>%s %sth</strong> <br /> if you have an questions please contact %s</body></html>' % (cfname, meetingmonth, meetingday, cleadfname)
try using termcolor
>>> from termcolor import cprint
>>> cprint("Hello", attrs=['bold'])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With