I have a paragraph and want to bold specific words in it, copy to clipboard for pasting into onenote. I can not figure out how to get the bold formatting to work. Here's what I have so far.
LL=L.split("****")
newlist = []
for line in LL:
newline = ""
if line.strip().isnumeric():
newline = newline + '<b>' + line + '</b>'
if any(string in line for string in boldstrings):
for string in line.split(" "):
if any(word in string for word in boldstrings):
newline = newline + '<b>' + string + '</b>' + " "
else:
newline = newline + string + " "
newline = newline + "\n"
print(newline)
newlist.append(newline)
r = Tk()
r.withdraw()
r.clipboard_clear()
r.clipboard_append(' '.join(newlist))
r.update() # now it stays on the clipboard after the window is closed
r.destroy()