python复制和粘贴word或onenote的格式化字符串

问题描述

我有一个段落,想将其中的特定单词加粗,复制到剪贴板以粘贴到 onenote 中。我不知道如何使粗体格式起作用。这是我目前所拥有的。

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()

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)